下载源码包 mysql-5.7.24 boost_1_59_0.tar.gz部署:# root @ k8s-mysql02 in ~ yum install -y cmake bison bison-devel libaio-devel gcc gcc-c++ git ncurses-devel# root @ k8s-mysql02 in ~ cd /usr/local/src# root @ k8s-mysql02 in ~tar -xf mysql-5.7.24.tar.gz # root @ k8s-mysql02 in ~mkdir /usr/local/src/mysql-5.7.24/boost# root @ k8s-mysql02 in ~ tar -xf boost_1_59_0.tar.gz -C /usr/local/src/mysql-5.7.24/boost/# root @ k8s-mysql02 in ~groupadd mysql# root @ k8s-mysql02 in ~useradd -M -s /sbin/nologin -r -g mysql mysql# root @ k8s-mysql02 in ~ mkdir -p /data/mysql/data# root @ k8s-mysql02 in ~ cd /usr/local/src/mysql# root @ k8s-mysql02 in ~ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/data/mysql/data/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/src/mysql-5.7.24/boost/boost_1_59_0# root @ k8s-mysql02 in ~ make && make install# root @ k8s-mysql02 in ~ chown mysql:mysql /usr/local/mysql/ -R# root @ k8s-mysql02 in ~ cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld# root @ k8s-mysql02 in ~ chmod +x /etc/init.d/mysqld# root @ k8s-mysql02 in ~ vim /etc/init.d/mysqld修改 basedir basedir=/usr/local/mysql修改 datadir datadir=/data/mysql/data# root @ k8s-mysql02 in ~ vim /etc/profile增加环境变量export PATH=/usr/local/mysql/bin:$PATH# root @ k8s-mysql02 in ~ source /etc/profile# root @ k8s-mysql02 in ~ /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/data/记住初始化密码# root @ k8s-mysql02 in ~ /etc/init.d/mysqld start# root @ k8s-mysql02 in ~ mysql -u root -p (需要修改密码)mysql> alter user 'root'@'localhost' identified by '1234';mysql> update user set authentication_string = password('1234') where user = 'root';