One MySQL server starts multiple ports

Source: Internet
Author: User

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

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.