MySQL Multi-instance configuration

Source: Internet
Author: User

In the actual development process, you may need to deploy multiple MySQL instances on a single server, it is recommended to use the official MySQL solution Mysqld_multi

1. Modify MY.CNF

As a reference configuration that defines two instances:

[Mysqld_multi] mysqld=/usr/local/mysql/bin/Mysqld_safe mysqladmin=/usr/local/mysql/bin/mysqladmin User=your_user Password=Your_password [mysqld1] DataDir=/data/db/my1 #连接 Port=3306Socket=/tmp/mysql3306.sock #binlog Log-bin=/data/db/mylog1/mysql-bin Binlog_format=Mixed Binlog_cache_size=32M expire_logs_days= -[Mysqld2] DataDir=/data/db/my2 #连接 Port=3307Socket=/tmp/mysql3307.sock #binlog Log-bin=/data/db/mylog2/mysql-bin Binlog_format=Mixed Binlog_cache_size=32M expire_logs_days=3 

2. Create a Data Catalog

mkdir -p/data/db/mkdir -p/data/db/chown mysql.mysql/data/db/my1-  chown

3. Initialize DB

/usr/local/mysql/scripts/mysql_install_db--datadir=/data/db/my1/-/usr/local/mysql/scripts/mysql_ install_db--datadir=/data/db/my2/-chown mysql.mysql/data/db/my1/-chown

4. Installation Tools

CP CP

5. Create and authorize users

" Your_user "@" 192.168.45.127% " ' Your_password '  "your_user" @ "192.168.1.%"

At this point, the MySQL multi-instance configuration is complete. We see that many different MySQL instances are shared with MY.CNF. Multi-instance command line management:

1.mysql Boot

11-2 Start instance 1,2

2.mysql restart

11-2 Restart instance 1,2

3.mysql off

11-2 Close instance 1,2

4. Command-line Login Instance 2

Mysql-u your_user-p your_password-p3307-s/tmp/mysql3307.sock

MySQL Multi-instance configuration

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.