#mysql5.6.36部署过程
#安装依赖
yum install -y gcc gcc-c++ automake autoconf git make
yum -y install cmake bison-devel ncurses-devel libaio-devel
#下载
#wget https://downloads.mysql.com/archives/get/file/mysql-5.6.36.tar.gz
chmod 1777 /tmp
#预编译
cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6.36 \
-DMYSQL_DATADIR=/application/mysql-5.6.36/data \
-DMYSQL_UNIX_ADDR=/application/mysql-5.6.36/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_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_ZLIB=bundled \
-DWITH_SSL=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLE_DOWNLOADS=1 \
-DWITH_DEBUG=0
#编译 && 安装
make && make install
#安装后操作
useradd -s /sbin/nologin mysql -M
ln -s /application/mysql-5.6.36 /application/mysql
chown -R mysql.mysql /application/mysql/data
/application/mysql/scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
/bin/cp /application/mysql/support-files/my-default.cnf /etc/my.cnf
/bin/cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
echo 'export PATH=/application/mysql/bin:$PATH' >> /etc/profile
. /etc/profile
#启动
/etc/init.d/mysqld start
#启动错误
#Starting MySQL.Logging to '/application/mysql-5.6.36/data/db01.err'.
#171113 13:07:01 mysqld_safe Directory '/application/mysql-5.6.36/tmp' for UNIX socket file don't exists.
# ERROR! The server quit without updating PID file (/application/mysql-5.6.36/data/db01.pid).
#这个错误源于这个配置
#-DMYSQL_UNIX_ADDR=/application/mysql-5.6.36/tmp/mysql.sock
#解决
mkdir /application/mysql-5.6.36/tmp
chown -R mysql.mysql /application/mysql-5.6.36/tmp