环境准备:
get http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.26.tar.gz
yum安装编译环境
yum -y install ncurses ncurses-devel openssl-devel bison gcc gcc-c++ make cmake
添加禁止登陆的mysql用户
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
解压
tar xzvf mysql-5.7.26.tar.gz
tar xzvf boost_1_59_0.tar.gz
mv boost_1_59_0/ mysql-5.7.26/
cd mysql-5.7.26/
参数设置
cmake \
-DWITH_BOOST=boost_1_59_0/ \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DSYSCONFDIR=/etc \
-DMYSQL_DATADIR=/home/mysql/ \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_SSL=system \
-DMYSQL_TCP_PORT=3306 \
-DENABLE_DOWNLOADS=1 \
-DWITH_SSL=bundled
开始编译
make && make install
修改属主属组
chown -R mysql:mysql /usr/local/mysql/
添加到系统服务
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
初始化数据库
/usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
/usr/local/mysql/bin/mysql_ssl_rsa_setup --datadir=/usr/local/mysql/data
设置环境变量
echo "export PATH=$PATH:/usr/local/mysql/bin/" >> /etc/profile
source /etc/profile
网友评论