MySQL Multi-instance configuration

Source: Internet
Author: User

In the test MySQL multi-master one from the server, that is, a multi-port synchronization from the server to different main libraries. This document records the operation of opening different ports.


Detailed steps:


1 , first of all, the my.cnf configuration file is copied a copy, open a few ports to copy several of course to rename .

Such as:


    1. Cp/usr/local/mysql/my.cnf/usr/local/mysql/my3307.cnf

    2. Cp/usr/local/mysql/my.cnf/usr/local/mysql/my3308.cnf

    3. Cp/usr/local/mysql/my.cnf/usr/local/mysql/my3309.cnf


2 my3306.cnf my3307.cnf my3308.cnf 3306 Port changed to &NBSP, 3307 3308 3309.

Such as:



[Client]

Port = 3308

Socket =/tmp/mysql3308.sock

Default-character-set=utf

[Mysqld]

Port = 3308

Socket =/tmp/mysql3308.sock

Basedir =/usr/local/mysql

DataDir =/www/mysqldata8

3. Initializing the database

/usr/local/mysql/scripts/mysql_install_db--datadir=/usr/local/mysql/mysqldata3306/--user=mysql--basedir=/usr/ Local/mysql

/usr/local/mysql/scripts/mysql_install_db--datadir=/usr/local/mysql/mysqldata3307/--user=mysql--basedir=/usr/ Local/mysql

/usr/local/mysql/scripts/mysql_install_db--datadir=/usr/local/mysql/mysqldata3308/--user=mysql--basedir=/usr/ Local/mysql


4. to start mysql, specify . CNF file and Directory startup

/usr/local/mysql/bin/mysqld_safe--defaults-extra-file=/usr/local/mysql/my3307.cnf--datadir=/usr/local/mysql/ data/mysqldata3307--user=mysql &

/usr/local/mysql/bin/mysqld_safe--defaults-extra-file=/usr/local/mysql/my3308.cnf--datadir=/usr/local/mysql/ data/mysqldata3308--user=mysql &

/usr/local/mysql/bin/mysqld_safe--defaults-extra-file=/usr/local/mysql/my3309.cnf--datadir=/usr/local/mysql/ data/mysqldata3309--user=mysql &


5. Stop MYSQL, corresponding to the sock file.

/usr/local/mysql/bin/mysqladmin-uroot-s/tmp/mysql3308.sock shutdown

6. Login MySQL

Mysql-s/tmp/mysq3308.sock-p 3308


Ps:

I'm not sure about whether the Mysql.sock file is using the same file or using the original file for linking. My method is to link the Mysql.sock file.

Ln-sf/tmp/mysql.sock/tmp/mysql3307.sock




This article is from the "sonw" blog, make sure to keep this source http://snow1988.blog.51cto.com/6351351/1765060

MySQL Multi-instance configuration

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.