####安装mysql-5.7.10
rpm -e --nodeps mysql
rpm -e mysqlclient10
useradd -g mysql -s /sbin/nologin
install_mysql_server()
{
cd /download/;unzip boost_1_59_0.zip
mkdir -p /usr/local/mysql/
mkdir -p /data/mysqldata
mkdir -p /usr/local/mysql/etc
tar -zxf mysql-5.7.10.tar.gz
cd mysql-5.7.10
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysqldata \
-DWITH_BOOST=../boost_1_59_0 \
-DSYSCONFDIR=/usr/local/mysql/etc \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DENABLE_DTRACE=0 \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DWITH_EMBEDDED_SERVER=1
make && make install
if [ $? -ne 0 ]; then
echo -e "Warnning \033[0;31;1m Mysql Make error \033[0m failed."
exit 10
fi
exit;
cd ../
/bin/cp /downloads/my.cnf /usr/local/mysql/etc/
ln -s /usr/local/mysql/etc/my.cnf /etc/
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /data/mysqldata
chown -R mysql:mysql /var/lib/mysql
}
install_mysql_server;