您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

mysqld_multi配置MySQL多实例_MySQL

2024/4/27 1:29:23发布47次查看
# 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 should have no other privileges. it is advised that you create a
#   common 'multi_admin' user for all mysql servers being controlled by
#   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 many mysql servers within the same data directory.
#   you can do so, but please make sure to understand and deal with the
#   underlying caveats. in short they are:
#   - 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 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 fifth 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 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 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/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
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product