先鄙视一下自己不实际验证操作一遍就转载文章的家伙,害得我折腾了一上午-_-
系统环境:CentOS5
操作步骤:
cd /var/lib
cp -a mysql /var/lib/mysql1
cp -a mysql /var/lib/mysql2
vi /etc/my_multi.cnf
[mysqld_multi]
mysqld = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
user = root
[mysqld1]
socket = /tmp/mysql.sock1
port = 3307
pid-file = /var/lib/mysql1/hostname.pid1
datadir = /var/lib/mysql1
log = /var/lib/mysql1/log-file.log
log-error = /var/lib/mysql1/log-error.err
[mysqld2]
socket = /tmp/mysql.sock2
port = 3308
pid-file = /var/lib/mysql2/hostname.pid2
datadir = /var/lib/mysql2
log = /var/lib/mysql2/log-file.log
log-error = /var/lib/mysql2/log-error.err
mysqld_multi --config-file=/etc/my_multi.cnf start 1,2 mysql -u root -S /tmp/mysql.sock1 |
vi yemaosheng_com.sh
#!/bin/sh if [ $1 == "start" ] then mysqld_multi --config-file=/etc/my_multi.cnf start 1,2 echo "All Mysql Start"; else mysqld_multi --config-file=/etc/my_multi.cnf stop 1,2 echo "All Mysql Stop"; fi |
sh yemaosheng_com.sh start
转载请注明出处:http://yemaosheng.com