CentOS runs mysql5.6 and mysql5.7 at the same time

Source: Internet
Author: User

CentOS runs mysql5.6 and mysql5.7 at the same time

First, prepare

    1. Download mysql5.6 and mysql5.7 from MySQL website

    2. Turn off the firewall and turn off SELinux

    3. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.