linux 64位centos下源码安装mysql服务教程
1.下载mysql源码包
打开地址https://dev.mysql.com/downloads/mysql/,选择下载MySQL Community Server源码包
分别选择Source Code和Generic Linux (Architecture Independent)选项,最后选择Compressed TAR Archive得到下载地址https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21.tar.gz
2.下载boost_1_66_0源码(https://dev.mysql.com/doc/refman/5.7/en/installing-source-distribution.html)
shell>mkdir /www/boost/
shell>wget "https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz"
shell>tar zxvf boost_1_66_0.tar.gz
2.linux下源码安装
shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> tar zxvf mysql-5.7.21.tar.gz
shell> cd mysql-5.7.21
shell> mkdir bld
shell> cd bld shell> cmake --WITH_BOOST /www/soft/boost/boost_1_66_0 ..
shell> make
编译很慢,取决于服务器的性能,4个cpu,编译1个小时左右
shell> make install
shell> cd /usr/local/mysql
shell> mkdir mysql-files
shell> chown mysql:mysql mysql-files
shell> chmod 750 mysql-files
shell> bin/mysqld--no-defaults--initialize --user=mysql --basedir=/usr/local/mysql --datadir=/www/mysql/data
shell> bin/mysql_ssl_rsa_setup
shell> bin/mysqld_safe --defaults-file=my.cnf &