全部博文(55)
分类: Mysql/postgreSQL
2011-10-19 10:16:20
2.修改mysql的配置文件my.cnf 创建mysqld_multi的config-file
[mysqld1]
port = 3306
socket = /tmp/mysql1.sock
datadir = /var/lib/mysql1
user = mysql
[mysqld2]
port = 3307
socket = /tmp/mysql2.sock
datadir = /var/lib/mysql2
user = mysql
[mysqld3]
port = 3308
socket = /tmp/mysql3.sock
datadir = /var/lib/mysql3
user = mysql
3. 初始化数据库
/usr/local/mysql/scripts/mysql_install_db --datadir=/var/lib/mysql1 --user=mysql
/usr/local/mysql/scripts/mysql_install_db --datadir=/var/lib/mysql2 --user=mysql
/usr/local/mysql/scripts/mysql_install_db --datadir=/var/lib/mysql3 --user=mysql
4. 启动多实例
mysqld_multi start 1-3
或
mysqld_multi start 1
mysqld_multi start 2
mysqld_multi start 3
6. 关闭数据库实例
mysqld_multi stop 1-3
或
mysqld_multi stop 1
mysqld_multi stop 2
mysqld_multi stop 3