Running two MySQL instances on the same server

Source: Internet
Author: User

Running two MySQL instances on the same server

It's not that complicated, two MySQL instances use different directory stores, use different port accesses, and load different configuration files.

If there are two MySQL A and b

MYSQL A is a system-standard RPM program installed. stored in the/var/lib/mysql configuration file for/etc/my.cnf, it's nothing special to change anything.

Now you need to run the second MySQL B, and you won't be able to rpm. Compile the installation using the source package. Specify the installation location as/USR/LOCAL/MYSQLB

The main compilation parameters are as follows:

./configue–prefix=/usr/local/mysqlb

Installation steps skipped ...

After installation, copy the configuration file/etc/my.cnf to/etc/myb.cnf.

and modify one of the

port=3307

Basedir=/usr/local/mysqlb

Datadir=/usr/local/mysqlb/var

After saving, manually specify the configuration file to start MySQL B:

/usr/local/mysqlb/bin/mysqld_safe–defaults-file=/etc/myb.cnf

Netstat to check it out, there are already 3306 33,072 MySQL running.


Specify the configuration file

Copy a my_setting.cnf, modified to 3340
/data/apps/mysql/bin/mysqld_safe--defaults-file=/data/apps/mysql/var/my_setting.cnf--user=mysql &


Note that the parameters of the specified configuration file should appear in the first position, the position of the interchange two parameters will be wrong, after startup, it is indeed 3340

6 Modifying Startup Parameters

/data/apps/mysql/bin/mysqld_safe--defaults-file=/data/apps/mysql/var/my_setting.cnf--user=mysql--port=3341 &


3341 Port after startup

#/usr/local/mysql/bin/mysqladmin-u Root-p shutdown

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.