Have you ever installed a lot of mysqld on one machine? If so, how do we do this? Is it true that I have compiled many mysql Databases in different directories and then started them one by one? If so, I strongly recommend using mysqld_multi, which can quickly configure N mysqld.
The procedure is as follows:
1) first install mysqld on the server, start and configure the mysql user
2) Copy the mysql database under the data Directory to the new mysql Server (N can be created)
3) Configure mysqld_multi
For specific configuration, see./mysqld_multi-example
[Mysqld_multi]
Mysqld =/usr/local/mysql/bin/mysqld_safe
Mysqladmin =/usr/local/mysql/bin/mysqladmin
User = yt
Password = yangting
[Mysqld1]
Datadir =/usr/local/mysql/data/
Basedir =/usr/local/mysql
Port = 3306
Socket =/tmp/mysql. sock
[Mysqld2]
Datadir =/usr/local/mysql/data2/
Basedir =/usr/local/mysql
Port = 3307
Socket =/tmp/mysql1.sock
Pid-file =/usr/local/mysql/data2/mysql2.pid
Default-storage-engine = innodb
[Mysql]
Prompt = mysql -- \ u @ \ h: \ d \ r: \ m: \ s>
4) Start and close
./Mysqld_multi -- log =/usr/local/mysql/data2/yt. err start
./Mysqld_multi -- log =/usr/local/mysql/data2/yt. err stop
You can also start mysqld_multi -- log =/usr/local/mysql/data2/yt. err start 1, 3-10 start
You can also./mysqld_multi -- log =/usr/local/mysql/data2/yt. err stop 2 to disable the second one.
Note: after getting up, make sure that each server has the user and password required by mysqld_mult and must be localhost.
Grant shutdown on *. * TO 'yt' @ 'localhost' identified by 'yangting ';
Otherwise, it cannot be stopped.
Author: "sky-peng"