1.安装MySQL基础及依赖软件
yum install ncurses-devel libaio-devel -y
cd /usr/local/src
wget http://www.cmake.org/files/v3.2/cmake-3.2.3.tar.gz --no-check-certificate
tar -zxvf cmake-3.2.3.tar.gz
cd cmake-3.2.3
./configure
gmake
gmake install
# 添加系统用户及目录
useradd -r mysql -s /sbin/nologin
mkdir /data/mysql/data -p
2.下载安装MySQL
cd /usr/local/src
wget ftp://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.6/mysql-5.6.32.tar.gz
tar -zxvf mysql-5.6.32.tar.gz
cd mysql-5.6.32
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6.32 \
-DMYSQL_DATADIR=/data/mysql/data \
-DMYSQL_UNIX_ADDR=/data/mysql/data/mysql.sock \
-DSYSCONFDIR=/etc \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DENABLE_DOWNLOADS=1 \
-DWITH_ZLIB=bundled \
-DWITH_READLINE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_DEBUG=0
make && make install
3.初始化及配置文件
ln -s /usr/local/mysql-5.6.32/ /usr/local/mysql
# 初始化数据库
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql/data/ --user=mysql
\cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chown -R mysql.mysql /data/mysql/data/
# 配置环境变量
echo 'PATH="/usr/local/mysql/bin:$PATH"' >> /etc/profile
source /etc/profile
# 设置MySQL用户密码
/usr/local/mysql/bin/mysqladmin -u root password '123'
4.启动数据
[root@zabbix mysql-5.6.32]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
[root@zabbix mysql-5.6.32]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.32 Source distribution
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>