CentOS runs mysql5.6 and mysql5.7 at the same time
First, prepare
Download mysql5.6 and mysql5.7 from MySQL website
Turn off the firewall and turn off SELinux
Create a MySQL user
~]# Useradd MySQL
Second, installation
Install mysql5.6 First
1. Unzip and rename
~]# Tar XF mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz-c/opt
~]# cd/opt
~]# MV Mysql-5.6.40-linux-glibc2.12-x86_64 mysql56
2. Initialize MySQL
~]# CD mysql56
~]#./scripts/mysql_install_db--user=mysql--datadir=/opt/mysql56/data--basedir=/opt/mysql56
Note: If the installation occurs during the
The workaround is to install the Autoconf library
Execute command: yum-y install autoconf
Continue to install MySQL command after installation is complete
This will automatically create a file in MySQL my.cng, edit this file
[Mysqld]basedir =/opt/mysql56datadir =/opt/mysql56/dataport = 3316 Socket =/opt/mysql56/mysql.sockexplicit_defaults_ For_timestamp=truesql_mode=no_engine_substitution,strict_trans_tables
3. Run Start mysql56
~]#./bin/mysqld_safe--defaults-file=/opt/mysql56/my.cnf--user=root &
Next Install mysql5.7
1. Unzip and rename
~]# Tar XF mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz-c/opt
~]# cd/opt
~]# MV Mysql-5.7.22-linux-glibc2.12-x86_64 mysql57
2. Edit MY.CNF
~]# vim/etc/my.cnf
[Client]port = 3326default-character-set = Utf8socket =/opt/mysql57/mysql.sock[mysql]port = 3326socket =/opt/mysql57/ Mysql.sock[mysqld]bind-address = 0.0.0.0log_error=/opt/mysql57/log/mysqld_error.logslow_query_log_file=/opt/ Mysql57/log/mysqld_slow.loggeneral_log_file=/opt/mysql57/log/mysqld_gener.logbasedir =/opt/mysql57datadir =/opt/ Mysql57/dataport = 3326 Socket =/opt/mysql57/mysql.sockexplicit_defaults_for_timestamp=truetmpdir =/opt/ Mysql57pid-file =/opt/mysql57/mysqld.pid
~]# mkdir Data Log
~]# bin/mysqld--initialize--user=mysql--basedir=/opt/mysql57--datadir=/opt/mysql57/data
~]# Cat Log/mysqld_error.log
Note the password in the red box, which is the root user password for MySQL
~]# mv/etc/my.cnf./
~]# bin/mysqld_safe--defaults-file=/opt/mysql57/my.cnf--user=root &
At this point, the CentOS installation mysql5.6 and mysql5.7 complete!!!
CentOS runs mysql5.6 and mysql5.7 at the same time