Mysqld_multi configuring MySQL Multi-instance

Source: Internet
Author: User

# A example of a my.cnf file for Mysqld_multi.
# Usually this file was located in Home dir ~/.my.cnf or/etc/my.cnf
#
# SOME IMPORTANT NOTES follow:
#
# 1.COMMON USER
#
# Make sure and the MySQL user, who's stopping the mysqld services, has
# The same password to all MySQL servers being accessed by Mysqld_multi.
# This user needs to has the ' Shutdown_priv '-privilege, but for security
# reasons should has no other privileges. It is advised so you create a
# common ' multi_admin ' user for all MySQL servers being controlled by
# Mysqld_multi. Here is a example how to do it:
#
# GRANT SHUTDOWN On * * to [email protected] identified by ' password '
#
# You'll need to apply the above to all MySQL servers that is being
# Controlled by Mysqld_multi. ' Multi_admin ' would shutdown the servers
# using ' mysqladmin '-binary, when ' mysqld_multi stop ' is being called.
#
# 2.pid-file
#
# If you is using Mysqld_safe to start mysqld, make sure that every
# MySQL Server has a separate pid-file. In order to use Mysqld_safe
# via Mysqld_multi, you need to use the options:
#
# Mysqld=/path/to/mysqld_safe
# ledir=/path/to/mysqld-binary/
#
# Ledir (Library executable directory), is an option and only Mysqld_safe
# accepts, so you'll get a error if you try to pass it to mysqld directly.
# for this reason might want to use the above options within [mysqld#]
# Group directly.
#
# 3.DATA DIRECTORY
#
# It isn't advised to run many MySQL servers within the same data directory.
# sure to understand and deal with the
# underlying caveats. In short they is:
#-Speed penalty
#-Risk of Table/data corruption
#-Data synchronising problems between the running servers
#-Heavily media (disk) bound
#-relies on the system (external) file locking
#-is not a applicable with all table types. (Such as InnoDB)
# Trying So would end up with undesirable results.
#
# 4.TCP/IP Port
#
# Every server requires one and it must be unique.
#
# 5. [mysqld#] Groups
#
# in the example below the first and the fifth Mysqld Group was
# intentionally left out. Gaps ' in the config file. This
# gives you more flexibility.
#
# 6.MySQL Server User
#
# You can pass the user=. option inside [mysqld#] groups. This
# can be very handy in some cases and then you need to run Mysqld_multi
# as UNIX root.
#
# 7.A start-up Manage Script for Mysqld_multi
#
# in the recent MySQL distributions you can find a file called
# mysqld_multi.server.sh. It's a wrapper for Mysqld_multi. This can
# is used to start and stop multiple servers during boot and shutdown.
#
# can place the file in/etc/init.d/mysqld_multi.server.sh and
# Make the needed symbolic links to it from various run levels
# (as per Linux/unix standard). Even replace the
#/etc/init.d/mysql.server script with it.
#
# before using, you must create a my.cnf file either in/usr/my.cnf
# or/root/.my.cnf and add the [Mysqld_multi] and [mysqld#] groups.
#
# The script can found from support-files/mysqld_multi.server.sh
# in MySQL distribution. (Verify the script before using)
#


[Mysqld_multi]
Mysqld =/usr/bin/mysqld_safe
Mysqladmin =/usr/bin/mysqladmin
user = Multi_admin
Password = My_password


[Mysqld2]
Socket =/tmp/mysql.sock2
Port = 3307
Pid-file =/var/lib/mysql2/hostname.pid2
DataDir =/var/lib/mysql2
Language =/usr/share/mysql/mysql/english
user = Unix_user1


[MYSQLD3]
Mysqld =/path/to/mysqld_safe
Ledir =/path/to/mysqld-binary/
Mysqladmin =/path/to/mysqladmin
Socket =/tmp/mysql.sock3
Port = 3308
Pid-file =/var/lib/mysql3/hostname.pid3
DataDir =/var/lib/mysql3
Language =/usr/share/mysql/mysql/swedish
user = Unix_user2


[Mysqld4]
Socket =/tmp/mysql.sock4
Port = 3309
Pid-file =/var/lib/mysql4/hostname.pid4
DataDir =/var/lib/mysql4
Language =/usr/share/mysql/mysql/estonia
user = Unix_user3


[Mysqld6]
Socket =/tmp/mysql.sock6
Port = 3311
Pid-file =/var/lib/mysql6/hostname.pid6
DataDir =/var/lib/mysql6
Language =/usr/share/mysql/mysql/japanese
user = Unix_user4

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.