Recently, a lot of friends in the use of MySQL encountered this problem: Originally in the server loaded with older versions of MySQL, such as 5.1,5.5 and so on. The updated version, such as 5.6 or 5.7 or higher, should be installed in some business need.
In this way, it is bound to face the following many problems:
1. Which version of the program do we use to start the MySQL service?
Is there a conflict in the 2.MySQL process?
3. How do I control which sockets are being monitored by different versions?
So, I began to try, after a number of failures, the final realization of such requirements, but the implementation is still relatively rough and humble, the configuration files and service startup scripts for each instance are still to be further perfected.
The experimental steps are as follows:
Lab Environment:
Operating system: RHEL6.0 32-bit
MySQL version: 5.5.48 and 5.6.29
Installation path for MySQL:
5.5.48:/usr/local/second/mysql
5.6.29:/usr/local/mysql
MySQL Data path:
5.5.48:/mydata/data/3306 and /mydata/data/3307
5.6.29:/mydata/data/3308 and /mydata/data/3309
/mydata is a mount point for a logical volume, that is: the MySQL data directory is on a logical volume
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7F/28/wKiom1cVAnLA9OdhAAAvAR7b_2c642.png "title=" Dfpng.png "alt=" Wkiom1cvanla9odhaaavar7b_2c642.png "/>
Installing MySQL Multi-instance
cd/usr/local/mysql/
scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--mydata/datadir=/mydata/data/3306/
scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--mydata/datadir=/mydata/data/3307/
Cd/usr/local/second/mysql
scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--mydata/datadir=/mydata/data/3308/
scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--mydata/datadir=/mydata/data/3309/
Preparing the configuration file
Mysqld_multi--example >/mydata/data/multi.cnf #提供多配置文件模板
Mv/mydata/data/multi.cnf/mydata/data/multi55.cnf/mydata/data/multi55.cnf
Cp/mydata/data/multi55.cnf/mydata/data/multi56.cnf
To provide configuration information for a configuration file
VIM/MYDATA/DATA/MULTI55.CNF #将配置文件中的内容替换为如下所示:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7F/25/wKioL1cU_LSh26-DAAA80j3A0S8168.png "title=" Multi55.cnf.png "alt=" Wkiol1cu_lsh26-daaa80j3a0s8168.png "/>
VIM/MYDATA/DATA/MULTI56.CNF #将配置文件中的内容替换为如下所示:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7F/27/wKiom1cU_AfxbainAAA683qelhs055.png "title=" Multi56.cnf.png "alt=" Wkiom1cu_afxbainaaa683qelhs055.png "/>
The above is a simple configuration file. This configuration file only lets MySQL start up. If you need more configuration, simply add it to the appropriate field.
-
simple service startup script sample
650) this.width=650; " Src= "Http://s5.51cto.com/wyfs02/M01/7F/25/wKioL1cVBpTj545_AAEdmST2JSg872.png" title= "Mysqld.png" alt= " Wkiol1cvbptj545_aaedmst2jsg872.png "/>
-
start service
service mysqld start my56
service mysqld start my55 3,4 Span style= "line-height:0px;" > < /span>
To view the creation of a socket file
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7F/25/wKioL1cVB0zgXctWAAAOW4MoTG0590.png "title=" Sock.png "alt=" Wkiol1cvb0zgxctwaaaow4motg0590.png "/>
Monitoring service startup status
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7F/28/wKiom1cVATHR4oO3AABevxXW3U0477.png "title=" Netstat.png "alt=" Wkiom1cvathr4oo3aabevxxw3u0477.png "/>
This article is from the "home of the Ops" blog, so be sure to keep this source http://zhaotianyu.blog.51cto.com/132212/1765224
MySQL Multi-version multi-instance implementation