Mysqld_multi configure multiple MySQL instances

Source: Internet
Author: User

# This is an example of a my. cnf file for mysqld_multi.
# Usually this file is located in home dir ~ /. My. cnf or/etc/my. cnf
#
# Some important notes follow:
#
#1. COMMON USER
#
# Make sure that the MySQL user, who is stopping the mysqld services, has
# The same password to all MySQL servers being accessed by mysqld_multi.
# This user needs to have the 'shutdown _ priv'-privilege, but for security
# Reasons shoshould have no other privileges. It is advised that you create
# Common 'multi _ admin' user for all MySQL servers being controlled
# Mysqld_multi. Here is an example how to do it:
#
# Grant shutdown on *. * TO multi_admin @ localhost identified by 'Password'
#
# You will need to apply the above to all MySQL servers that are being
# Controlled by mysqld_multi. 'multi _ admin' will shutdown the servers
# Using 'mysqladmin'-binary, when' mysqld _ multi stop' is being called.
#
#2. PID-FILE
#
# If you are 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 two options:
#
# Mysqld =/path/to/mysqld_safe
# Ledir =/path/to/mysqld-binary/
#
# Ledir (library executable directory), is an option that only mysqld_safe
# Accepts, so you will get an error if you try to pass it to mysqld directly.
# For this reason you might want to use the above options within [mysqld #]
# Group directly.
#
#3. DATA DIRECTORY
#
# It is NOT advised to run your MySQL servers within the same data directory.
# You can do so, but please make sure to understand and deal with
# Underlying caveats. In short they are:
#-Speed penalty
#-Risk of table/data Partition uption
#-Data synchronising problems between the running servers
#-Heavily media (disk) bound
#-Relies on the system (external) file locking
#-Is not applicable with all table types. (Such as InnoDB)
# Trying so will 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 second th mysqld group was
# Intentionally left out. You may have '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, but 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 is a wrapper for mysqld_multi. This can
# Be used to start and stop multiple servers during boot and shutdown.
#
# You 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). You may even replace
#/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 be 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/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/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/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/Japan
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.