1. 下载mysql二进制版本到主节点服务器
[root@mysql_node1 ~]# wget http://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.32-linux-glibc2.5-x86_64.tar.gz
[root@mysql_node1 ~]# tar zxvf mysql-5.6.32-linux-glibc2.5-x86_64.tar.gz
2. 创建mysql的默认安装目录
[root@mysql_node1 ~]# tar zxvf mysql-5.6.32-linux-glibc2.5-x86_64.tar.gz
[root@mysql_node1 ~]# mkdir /usr/local/mysql
[root@mysql_node1 mysql-5.6.32-linux-glibc2.5-x86_64]# cp -R * /usr/local/mysql/
3. 安装MySQL
3.1 编辑mysql的默认配置文件
[root@mysql_node1 ~]# cd /usr/local/mysql/
[root@mysql_node1 mysql]# vim support-files/my-default.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /data
port = 3306
server_id = 1
socket = /tmp/mysql.sock
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
3.2 初始化mysql数据库
[root@mysql_node1 mysql]# cp support-files/my-default.cnf /etc/my.cnf
[root@mysql_node1 mysql]# useradd -s /sbin/nologin -M mysql
[root@mysql_node1 mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data --basedir=/usr/local/mysql/
[root@mysql_node1 mysql]# cd bin/
[root@mysql_node1 bin]# cp -R * /usr/bin/
3.3 启动mysql服务
[root@mysql_node1 data]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/
[root@mysql_node1 data]# /etc/init.d/mysql.server start
[root@mysql_node1 data]# /etc/init.d/mysql.server status
SUCCESS! MySQL running (3155)
3.4 Mysql的data目录设置为/data方便后期drbd进行数据同步