User Tools

Site Tools


two_mysql_instances

Two Mysql Instances

  1. install mysql
  2. copy the mysql data directory to say mysql1

So you have /var/db/mysql and /var/db/mysql1

  1. 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>
  1. start the first mysql server
  1. 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>
  1. 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.

further reference

two_mysql_instances.txt · Last modified: 2020/08/10 02:35 (external edit)