WEB开发网
开发学院数据库MySQL 在Linux下安装多个MySQL 阅读

在Linux下安装多个MySQL

 2010-09-05 15:57:58 来源:WEB开发网   
核心提示:示例配置文件[root@ff_girl mysql5122]# cat /etc/my5122.cnf[mysqld_multi]mysqld = /usr/local/mysql5122/bin/mysqld_safemysqladmin = /usr/local/mysql5122/bin/mysqladminus

示例配置文件

[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 = 8M
sort_buffer_size = 8M

[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout
[root@ff_girl mysql5122]#

启动两个MYSQL服务

[root@ff_girl mysql5122]# /usr/local/mysql5122/bin/mysqld_multi --config-file=/etc/my5122.cnf start 1-2
[root@ff_girl mysql5122]# netstat -an | grep 3307
tcp    0   0 0.0.0.0:3307        0.0.0.0:*          LISTEN   
[root@ff_girl mysql5122]# netstat -an | grep 3308
tcp    0   0 0.0.0.0:3308        0.0.0.0:*          LISTEN   
[root@ff_girl mysql5122]# /usr/local/mysql/bin/mysql -uroot -p -S/tmp/mysql1.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-log MySQL Community Server (GPL)

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql> q
Bye
[root@ff_girl mysql5122]# /usr/local/mysql/bin/mysql -uroot -p -S/tmp/mysql2.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-log MySQL Community Server (GPL)

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql> q
Bye
[root@ff_girl mysql5122]#

Tags:Linux 多个

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接