Because of the temporary requirements, you need to start multiple instances of MySQL on a single host, corresponding to different ports.
The steps are as follows:
1, install MySQL.
2. Set the configuration file for each instance.
3, create datadir for different instances, and perform database initialization.
4, start a different MySQL instance.
The following is a detailed installation method:
1, install MySQL
Install using source code.
-zxvf mysql-5.5.49.tar.gz cd mysql-5.5.49mkdir /usr/local--DCMAKE_INSTALL_PREFIX=/usr/local
2, first set the next my.cnf
cp support-files/my-medium.cnf /etc/my.cnf -R /usr/local/mysql/.--user=--basedir=/usr/local--datadir=/dbdata/mysql/data初始化数据库
3. Set a different directory file
Mkdir-p/dbdata/{3307,3308,3309}/datacp/etc/my.cnf/dbdata/3307/cp/etc/my.cnf/dbdata/3308/cp/etc/my.cnf/dbdata/ 3309/VIM/DBDATA/3307/MY.CNF ++++++++++++++++++[client]Port= 3307Socket=/dbdata/3307/mysql.sock[mysqld]Port= 3307Socket=/dbdata/3307/mysql.sockskip-external-lockingkey_buffer_size= 16MMax_allowed_packet= 1MTable_open_cache= 64sort_buffer_size= 512KNet_buffer_length= 8Kread_buffer_size= 256Kread_rnd_buffer_size= 512Kmyisam_sort_buffer_size= 8mskip-name-resolveBasedir=/usr/local/mysqlDataDir=/dbdata/3307/datalog-bin=mysql-binBinlog_format=mixedserver-id = 1[mysqldump]quickMax_allowed_packet= 16m[mysql]no-auto-rehash[myisamchk]key_buffer_size= 20Msort_buffer_size= 20MRead_buffer= 2MWrite_buffer= 2m[mysqlhotcopy]interactive-timeout[mysqld_safe]log-error=/dbdata/3307/3307.errpid-file=/dbdata/3307/3307.pid
Change configuration files for 3308 3309 ports, respectively
4, Initialize Startup
/usr/Local/mysql/scripts/mysql_install_db--Basedir=/usr/Local/mysql--DataDir=/dbdata/3307/Data --User=mysql/usr/Local/mysql/scripts/mysql_install_db--Basedir=/usr/Local/mysql--DataDir=/dbdata/3308/Data --User=mysql/usr/Local/mysql/scripts/mysql_install_db--Basedir=/usr/Local/mysql--DataDir=/dbdata/3309/Data --User=MySQL Boot:/usr/Local/mysql/bin/mysqld_safe--Defaults-file=/dbdata/3307/my.Cnf&/usr/Local/mysql/bin/mysqld_safe--Defaults-file=/dbdata/3308/my.Cnf&/usr/Local/mysql/bin/mysqld_safe--Defaults-file=/dbdata/3309/my.Cnf&Login: MySQL-uroot - P - S/dbdata/3308/mysql.Sock Change Password mysqladmin-uroot - PPassword123456 - S/dbdata/3307/mysql.Sock
Complete.
Mysql 5.5 Multi-instance deployment steps