Centos6.4编译安装mysql 8.0.0 详细教程
时间:2020-11-02 13:48 作者:admin610456
本文实例为大家分享了Centos6.4编译mysql/' target='_blank'>mysql 8.0.0 安装配置方法,供大家参考,具体内容如下
操作系统说明:CentOS 6.4
数据库版本:MySQL 8.0.0
一.环境准备
yum install ncurses-devel -yyum install libaio -yyum install glibc-devel.i686 glibc-devel -yyum install gcc gcc-c++ -y
另外,MySQL8.0需要用gcc的版本为 4.8以上,而centos 6.4通过yum只能安装到4.4.7,所以在安装mysql8.0之前需要手动安装更高版本的gcc,我这里以gcc-8.8.2为例:
wget ftp://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.gztar xf gcc-4.8.2.tar.gzcd gcc-4.8.2
# 载编译需要的依赖包:./contrib/download_prerequisites
./configure --prefix=/usr/local/gcc-4.8.2/ --enable-bootstrap --enable-threads=posix --enable-languages=c,c++,objc,obj-c++
make &&make install
说明:make的时间会很长。
安装完后,还需要将原来的gcc环境用新版本的gcc替换掉,否则mysql在安装时还是用的原来的gcc:
mv /usr/bin/gcc /usr/bin/gcc447mv /usr/bin/g++ /usr/bin/g++447mv /usr/bin/c++ /usr/bin/c++447mv /usr/bin/cc /usr/bin/cc447
ln -s /usr/local/gcc-4.8.2/bin/gcc /usr/bin/gccln -s /usr/local/gcc-4.8.2/bin/g++ /usr/bin/g++ln -s /usr/local/gcc-4.8.2/bin/c++ /usr/bin/c++ln -s /usr/local/gcc-4.8.2/bin/gcc /usr/bin/cc
mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.bakln -s /usr/local/gcc-4.8.2/lib64/libstdc++.so.6.0.18 /usr/lib64/libstdc++.so.6
解决如下问题:
接着,安装boost库:
wget -c http://sourceforge.net/projects/ ... oost_1_60_0.tar.bz2 --no-check-certificatetar xf boost_1_60_0.tar.bz2\?r\=\&ts\=1479114685\&use_mirror\=ncucd boost_1_60_0./bootstrap.sh ./b2 stage threading=multi link=shared./b2 install threading=multi link=shared
二.安装mysql8.0
# 下载和解压mysql
wget -c http://dev.mysql.com/get/Downloa ... st-8.0.0-dmr.tar.gz
tar xf mysql-boost-8.0.0-dmr.tar.gz
# 编译安装mysql
cd mysql-8.0.0-dmrcmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_DATADIR=/usr/local/mysql/data/ -DSYSCONFDIR=\etc\mysql \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DMYSQL_TCP_PORT=3306 \-DENABLED_LOCAL_INFILE=1 \-DEXTRA_CHARSETS=all \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DWITH_BOOST=/tmp/boost_1_60_0/makemake install
# 新增mysql用户和组,并配置mysql用户对数据库目录的权限
groupadd mysql useradd -g mysql mysql chown mysql.mysql /usr/local/mysql -R
# 初始化mysql
cd /usr/local/mysqlbin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/bin/mysql_ssl_rsa_setup
# 配置文件
cp ./support-files/my-default.cnf /etc/my.cnf vim /etc/my.cnf[mysqld]datadir=/usr/local/mysql/data/socket=/var/lib/mysql/mysql.sockuser=mysql# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0pid-file=/var/run/mysqld/mysqld.pidlog-error=/var/log/mysqld.log
# 创建进程文件目录
mkdir /var/run/mysqldchown mysql /var/run/mysqld/ -R
# 设置环境变量
echo "export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/sbin" >> /etc/profilesource /etc/profile
# 设置开机启动脚本
cd /usr/local/mysqlcp support-files/mysql.server /etc/init.d/mysql.serverchkconfig mysql.server onservice mysql.server start
精彩专题分享:mysql不同版本安装教程 mysql5.7各版本安装教程
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
(责任编辑:admin)