我想在CentoS上运行2个单独的mysql实例,这些实例可以在不同的端口上分别停止和启动,并且具有完全独立的数据库
我的/etc/my.cnf是:
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/lib/mysql/mysql.sock
port = 3306
datadir = /var/lib/mysql
[mysqld_safe]
log-error=/var/log/mysqld.log
我的/etc/my2.cnf如下:
[mysqld2]
datadir=/var/lib/mysql2
socket=/var/lib/mysql/mysql2.sock
user=mysql
Disabling symbolic-links is recommended to prevent assorted security risks
#symbolic-links=0
[mysqld2]
user = mysql
pid-file = /var/run/mysqld/mysqld2.pid
socket = /var/lib/mysql/mysql2.sock
port = 3307
datadir = /var/lib/mysql2
[mysqld_safe]
log-error=/var/log/mysqld2.log
pid-file=/var/run/mysqld/mysqld2.pid
当我启动mysqld服务时,即使mysqld2也被启动,并且它们都显示相同的数据库。我可以同时在3306和3307端口上连接到mysql。
服务mysqld状态和服务mysqld2状态显示使用相同的pid
我如何拥有2个完全不同的mysqls和mysqld2服务,分别在3306和3307端口上运行runninf,它们可以分别停止和启动?