I have installed Multiple MySQL service notes in the Linux environment. For more information, see!
1. Install it as usual.
[Root @ ff_girl mysql5122] # chown-R root.
[Root @ ff_girl mysql5122] # chown-R mysql data
[Root @ ff_girl mysql5122] # chgrp-R mysql.
[Root @ ff_girl mysql5122] # cp support-files/my-small.cnf/etc/my5122.cnf
[Root @ ff_girl mysql5122] # scripts/mysql_install_db -- basedir =/usr/local/mysql5122/-- datadir =/usr/local/mysql5122/data/-- user = mysql
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
Support-files/mysql. server to the right place for your system
...
Start MYSQL for the first time
[Root @ ff_girl mysql5122] # bin/mysqld_safe -- defaults-file =/etc/my5122.cnf &
[1] 13700
[Root @ ff_girl mysql5122] #080124 15:01:46 mysqld_safe Logging to '/usr/local/mysql5122/data/localhost. localdomain. err '.
080124 15:01:46 mysqld_safe Starting mysqld daemon with databases from/usr/local/mysql5122/data
[Root @ ff_girl mysql5122] # bin/mysql-uroot-p-S/tmp/mysql5122.sock
Enter password:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 1
Server version: 5.1.22-rc MySQL Community Server (GPL)
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Mysql |
| Test |
+ -------------------- +
3 rows in set (0.00 sec)
Grant SHUTDOWN permission to MYSQLD_MULTI.
Mysql> grant shutdown on *. * to multi_admin @ 'localhost' identified by '123 ';
Query OK, 0 rows affected (0.00 sec)
Mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Mysql> exit
Bye
Stop the MYSQL service.
[Root @ ff_girl ~] #/Usr/local/mysql5122/bin/mysqladmin-uroot-p-S/tmp/mysql5122.sock shutdown
Enter password:
[Root @ ff_girl ~] #
Copy metadata.
[Root @ ff_girl mysql5122] # cp data data2
[Root @ ff_girl mysql5122] # mv data data1
[Root @ ff_girl mysql5122] # chown-R mysql data2
[Root @ ff_girl mysql5122] # chgrp-R mysql.
Sample configuration file
[Root @ ff_girl mysql5122] # cat/etc/my5122.cnf
[Mysqld_multi]
Mysqld =/usr/local/mysql5122/bin/mysqld_safe
Mysqladmin =/usr/local/mysql5122/bin/mysqladmin
User = multi_admin
Password = 123456
# The MySQL server
[Mysqld1]
Socket =/tmp/mysql1.sock
Port = 3307
Pid-file =/usr/local/mysql5122/data1/David _yeung.pid1
Datadir =/usr/local/mysql5122/data1
Language =/usr/local/mysql5122/share/mysql/english
User = mysql
# The MySQL server
[Mysqld2]
Port = 3308
Socket =/tmp/mysql2.sock
Pid-file =/usr/local/mysql5122/data2/David _yeung.pid2
Datadir =/usr/local/mysql5122/data2
Language =/usr/local/mysql5122/share/mysql/english
User = mysql
...
[Isamchk]
Key_buffer = 8 M
Sort_buffer_size = 8 M
[Myisamchk]
Key_buffer = 8 M
Sort_buffer_size = 8 M
[Mysqlhotcopy]
Interactive-timeout
[Root @ ff_girl mysql5122] #