curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo && \
yum clean all &&\
yum install -y wget gcc gcc-c++ automake autoconf make cmake bison-devel ncurses-devel libaio-devel &&\
mkdir /server/tools /application -p &&\
cd /server/tools &&\
useradd mysql -s /sbin/nologin -M && \
wget https://www.chenleilei.net/soft/mysql-boost-5.7.20.tar.gz &&\
tar xf mysql-boost-5.7.20.tar.gz &&\
rm -f mysql-boost-5.7.20.tar.gz &&\
cd mysql-5.7.20 &&\
cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.7.20 \
-DMYSQL_DATADIR=/application/mysql-5.7.20/data \
-DMYSQL_UNIX_ADDR=/application/mysql-5.7.20/tmp/mysql.sock \
-DDOWNLOAD_BOOST=1 -DWITH_BOOST=./boost \
-DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_ZLIB=bundled -DWITH_SSL=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLE_DOWNLOADS=1 \
-DWITH_DEBUG=0 &&\
make && make install &&\
chown -R mysql.mysql /application/mysql-5.7.20 &&\
/application/mysql-5.7.20/bin/mysqld --initialize-insecure --user=mysql --basedir=/application/mysql-5.7.20 --datadir=/application/mysql-5.7.20/data
echo -e "[mysqld] \
basedir=/application/mysql \
datadir=/application/mysql-5.7.20/data \
socket=/tmp/mysql.sock \
log_error=/var/log/mysql.log \
user=mysql \
port=3306 \
[client] \
socket=/tmp/mysql.sock" >/etc/my.cnf
rm -rf /server/tools/mysql-5.7.20 && \
rm -rf /var/cache/yum/*
echo 'PATH=/application/mysql/bin/:$PATH' >>/etc/profile && \
source /etc/profile && \
\cp /application/mysql-5.7.20/support-files/mysql.server /etc/init.d/mysqld && \
mkdir  /application/mysql-5.7.20/tmp -p && \
ln -s /application/mysql-5.7.20 /application/mysql && \
/etc/init.d/mysqld start