two_mysql_instances
Two Mysql Instances
- install mysql
- copy the mysql data directory to say mysql1
So you have /var/db/mysql and /var/db/mysql1
- Open the first mysql /var/db/mysql/my.cnf
Change
<code text> port = <The port you want the first mysql to listen to> bind-address = <The ip you want the first mysql to bind to> </code>
- start the first mysql server
- Open the second mysql /var/db/mysql1/my.cnf
Change
port = <The port you want the second mysql to listen to> bind-address = <The ip you want the second mysql to bind to>
- Write the startup command for the second mysql server
/usr/local/bin/mysqld_safe --bind-address=<The ip address you want to bind the second mysql server to> --user=mysql --socket=/tmp/mysql1.sock --datadir=/var/db/mysql1 --pid-file=/var/run/mysql1.pid &
This works great for n number of mysql servers. Tested and working on one of my live servers.
two_mysql_instances.txt · Last modified: 2020/08/10 02:35 by 127.0.0.1