1. 下载二进制mysql的安装包
[root@minion-1 ~]#wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.42-linux-glibc2.12-x86_64.tar.gz
2. 新建一个专放软件的目录
[root@minion-1 ~]#mkdir -p /services/current_apps
3. 解压包到放软件的目录下
[root@minion-1 ~]# tar -xzf mysql-5.6.42-linux-glibc2.12-x86_64.tar.gz -C /services/current_apps
4. 进入目录
[root@minion-1 ~]# cd /services/current_apps/mysql-5.6.42-linux-glibc2.12-x86_6
5. 拷贝服务的模板文件
[root@minion-1 mysql-5.6.42-linux-glibc2.12-x86_64]# cp support-files/mysql.server /etc/init.d/mysqld
6. 拷贝my.cnf配置模板
[root@minion-1 mysql-5.6.42-linux-glibc2.12-x86_64]# cp support-files/my-default.cnf /etc/my.cnf
7. 修改两个参数,稍后用作数据目录和mysql安装目录
[root@minion-1 mysql-5.6.42-linux-glibc2.12-x86_64]# vi /etc/init.d/mysqld
#If you change base dir, you must also change datadir. These may get
overwritten by settings in the MySQL configuration files.
basedir=/usr/local/mysql
datadir=/data/mysql
8. 新建上面的mysql数据目录
[root@minion-1 mysql-5.6.42-linux-glibc2.12-x86_64]# mkdir /data
9. 软连接mysql安装目录
[root@minion-1 mysql-5.6.42-linux-glibc2.12-x86_64]# ln -s /services/current_apps/mysql-5.6.42-linux-glibc2.12-x86_64/ /usr/local/mysql
10. 初始化mysql的数据目录
[root@minion-1 mysql-5.6.42-linux-glibc2.12-x86_64]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
11. 把mysqld服务加入服务启动
[root@minion-1 mysql-5.6.42-linux-glibc2.12-x86_64]# chkconfig --add mysqld
12.启动mysqld 服务,显示success表示成功
[root@minion-1 mysql-5.6.42-linux-glibc2.12-x86_64]# service mysqld start
Starting MySQL.Logging to ‘/data/mysql/minion-1.err‘.
... SUCCESS!
13 确认服务mysql的确开启,返回1说明开了
[root@minion-1 mysql-5.6.42-linux-glibc2.12-x86_64]# netstat -tupln|grep 3306|wc -l
1
原文地址:https://blog.51cto.com/popli3/2357211