One server starts two MySQL instances

Source: Internet
Author: User
On one server, you can use mysqld_multi to configure multiple Mysql instances to run. Assume that a MYSQL instance is running on the server, and the data directory is varlibmys.

On one server, you can use mysqld_multi to configure multiple Mysql instances to run. Assume that a MYSQL instance is running on the server. The data directory is/var/lib/mys.

On one server, you can use mysqld_multi to configure multiple Mysql instances to run.

Assume that a MYSQL instance is running on the server. The data directory is/var/lib/mysql and the port is 3306. The SOCKET connection file used is located in/tmp/mysql. sock. You can start one or more instances as follows.

1. Create a data directory for the new instance

After the new MySQL instance is started, the directory where the data is located is the directory under which the database files related to the instance are to be put. Suppose I put them in the/var/lib/mysql2 directory.

Mkdir/var/lib/mysql2 create a directory.

Chown mysql/var/lib/mysql2 grant mysql user permissions.

2. Create a database

This step initializes the database under the Created directory.

Bin/mysql_install_db -- user = mysql -- datadir =/var/lib/mysql2 // install mysql and other system databases to the directory where the instance is ready to run.

3. Configuration File

Modifying the configuration file my. cnf is also the most important step. It is mainly to reset the pid-file, socket, port and other attributes of each instance. My configuration file is as follows:

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.