mkdir /tools && cd /tools
mysql下载 https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.22.tar.gz
下载boost源码 https://jaist.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
groupadd mysql
useradd -s /sbin/nologin -M -g mysql mysql
yum install make gcc gcc-c++ cmake bison-devel ncurses-devel git perl-Module-Install.noarch libaio-devel -y
cd /tools && tar xf /tools/mysql-5.7.22.tar.gz
mv /tools/boost_1_59_0.tar.gz /tools/mysql-5.7.22
mkdir /tools/mysql-5.7.22/debug
mkdir /application/mysql
mkdir /data/3306
cd /tools/mysql-5.7.22/debug
cmake .. -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=RelWithDebInfo -DINSTALL_LAYOUT=STANDALONE -DENABLE_DTRACE=OFF -DWITH_EMBEDDED_SERVER=OFF -DWITH_INNODB_MEMCACHED=ON -DWITH_SSL=bundled -DWITH_ZLIB=system -DWITH_PAM=on -DCMAKE_INSTALL_PREFIX=/application/mysql -DINSTALL_PLUGINDIR=/application/mysql/lib/plugin -DMYSQL_DATADIR=/data/3306/data -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/data/3306/mysqld.sock -DSYSTEMD_PID_DIR=/data/3306 -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EDITLINE=bundled -DFEATURE_SET=community -DCOMPILATION_COMMENT="MySQL Server (GPL)" -DWITH_DEBUG=OFF -DWITH_BOOST=..
make -j grep processor /proc/cpuinfo|wc -l
make install
cp /application/mysql/support-files/mysql.server /etc/init.d/mysql
vim /etc/my.cnf
[mysqld] user = mysql port = 3306 socket = /data/3306/mysql.sock basedir = /application/mysql datadir = /data/3306/data
chown -R mysql.mysql /data/3306
/application/mysql/bin/mysqld --defaults-file=/etc/my.cnf --initialize-insecure
/etc/init.d/mysql start
echo "set password=password('123456');"| mysql -S /data/3306/mysql.sock
mysql -uroot -p123456 -S /data/3306/mysql.sock