One MySQL server starts multiple ports to test Mysql multi-master and one slave server, that is, one slave server synchronizes multiple ports to different master databases. This document describes how to enable different ports. Detailed steps: 1. First, you must first put my. copy a copy of The cnf configuration file, and copy a few copies of the opened ports. Of course, rename the configuration file. for example, cp/etc/my. cnf/etc/my3306.cnf cp/etc/my. cnf/etc/my3307.cnf cp/etc/my. cnf/etc/my3308.cnf 2. Modify my_1.cnf my_2.cnf my_3.cnf and change the default port 3306 to 3307 3308 3309. for example: [client] port = 3308 socket =/tmp/mysql3308.sock default-character-set = UTF [mysqld] port = 3308 socket =/tmp/mysql3308.sock basedir =/usr/local/mysql datadir =/www/mysqldata83. Create a database and specify the data storage directory mk. Dir/www/mysqldata3306 mkdir/www/mysqldata3307 mkdir/www/mysqldata3308 4, initialize database/usr/local/mysql/scripts/mysql_install_db -- datadir =/www/mysqldata3306/-- user = mysql -- basedir =/usr/local/mysql/scripts/mysql_install_db -- datadir =/www/mysqldata3307/-- user = mysql -- basedir =/usr/local/ mysql/usr/local/mysql/scripts/mysql_install_db -- datadir =/www/mysqldata3308/-- user = mysql -- basedir =/Usr/local/mysql 5. To start mysql, specify. start/usr/local/mysql/bin/mysqld_safe -- defaults-extra-file =/etc/my3306.cnf -- datadir =/www/mysqldata3306 -- user = mysql &/usr /local/mysql/bin/mysqld_safe -- defaults-extra-file =/etc/my3307.cnf -- datadir =/www/mysqldata3307 -- user = mysql &/usr/local/mysql/bin/ mysqld_safe -- defaults-extra-file =/etc/my3308.cnf -- datadir =/www/mysqldata3308 -- user = mysql & 6. Stop MYSQL, corresponding. /Usr/local/mysql/bin/mysqladmin-uroot-S/tmp/mysql3308.sock shutdown 7. log on to mysql-S/tmp/mysq3308.sock-P 3308