本文实例为大家分享了Centos6.4编译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 |