# #安装mysql需要的依赖包
Yum Install Ncurses-devel libaio-devel-y
# #安装编译MySQL需要的软件
As the MySQL5.5 and above series of products to be installed in a special way, it is necessary to install the commonly used compiled MySQL tool cmake software package, the command is:
Yum Install Cmake-y
# #上传软件到/home/oldboy/tools
Unzip the Tar XF
# #编译
CMake \
-dcmake_install_prefix=/application/mysql-5.6.34 \
-dmysql_datadir=/application/mysql-5.6.34/data \
-dmysql_unix_addr=/application/mysql-5.6.34/tmp/mysql.sock \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-DEXTRA_CHARSETS=GBK,GB2312,UTF8,ASCII \
-denabled_local_infile=on \
-dwith_innobase_storage_engine=1 \
-dwith_federated_storage_engine=1 \
-dwith_blackhole_storage_engine=1 \
-dwithout_example_storage_engine=1 \
-dwith_fast_mutexes=1 \
-dwith_zlib=bundled \
-denabled_local_infile=1 \
-dwith_readline=1 \
-dwtih_embedded_server=1 \
-dwith_debug=0
# #创建软连接
Ln-s/application/mysql-5.6.34//application/mysql
Useradd-s/sbin/nologin-m MySQL
Chown-r mysql.mysql/application/mysql/
# Copy configuration file
\cp/application/mysql/support-files/my-default.cnf/etc/my.cnf
# initialization
/application/mysql/scripts/mysql_install_db--basedir=/application/mysql--datadir=/application/mysql/data/-- User=mysql
# Authorized users
Chown-r MySQL. /application/mysql*
# Copy startup file
\cp/application/mysql/support-files/mysql.server/etc/init.d/mysqld
# Down right, down authority
chmod 700/etc/init.d/mysqld
# Boot from Boot
Chkconfig mysqld on
Chkconfig--list mysqld
/etc/init.d/mysqld start
# cp/application/mysql/bin/mysql/usr/local/sbin/
# The configuration file for the command.
echo "path=/application/mysql/bin/: $PATH" >>/etc/profile
Tail-1/etc/profile
. /etc/profile
Echo $PATH
MySQL-5.6.34 installation (centos7.2)