Yesterday, I setup mysqld-multi in my.cnf. It works fantastic, but there is still a further Problem.

The first DB on socket 1 running as Slave from a other server. The second one from socket 2 should run as Master for a further Slave. The replication for DB 1 running successful.

My question is it possible to setup the master-slave environment for every socket? Is it basically possible to setup more than one master-slave configuration in my.cnf?

I couldn't found helpful hints in google or I doesn't have the correct search words.

I'm happy for any helpful hints.

My system is Debian 6 with mysql 5 and php.

[mysqld1] read-only # comment out only on the productive 
dbmaster port = 3306 
datadir = /var/lib/mysql 
pid-file = /var/lib/mysql/mysqld.pid 
socket = /var/lib/mysql/mysql.sock 
user = mysql 
innodb_data_home_dir = /var/lib/mysql 
innodb_log_group_home_dir = /var/lib/mysqlinnolog 
relay-log = /var/log/mysql/master-relay-bin 
relay-log-index = /var/log/mysql/master-relay-bin.index 
log-bin = /var/log/mysql/relaylog/master-bin

port = 3307 
datadir = /var/lib/mysql-data2/mysqld2 
pid-file = /var/lib/mysql-data2/mysqld2/mysql.pid 
socket = /var/lib/mysql-data2/mysqld2/mysql.sock 
user = mysql 
log-bin = /var/log/data2/mysql-bin

Both instance have a specific port and a separate Datadir. Is it possible to give each section in the snippet a unique ID? Can I put the Slave ID in section [mysqld1] and the master ID in [mysqld2]?

  • Can you explain your second question ("Is it basically possible to setup more than one master-slave configuration in my.cnf"?) more as all the servers running will be using the different my.cnf Commented May 29, 2012 at 11:07
  • Ok basically my.cnf has a section like this: master-user = mysqlslave server-id = 100 report-host = myslave_1...my slave get id101 .... can I move this section as option for DB1 and create a new master settings for db2? Commented May 29, 2012 at 11:14

1 Answer 1


I address something like this back on May 31, 2011 : MySQL connection doesn't work anymore

Essentailly, you must make sure each mysql instance has a unique socket file, datadir, slow log, error log, and its fair share of memory.

You could look into setting up a separate mysqld service for a specific port : Running multiple instances on the same host

You should make sure db2 has a unique server_id. Furthermore, if the Slave is to be a Master also, make sure you have log-slave-updates in my.cnf for this Slave.

  • Tanks Rolando.... the first steps are successfull but where in my.cnf can I set the unique server_id? Commented May 30, 2012 at 7:48
  • BIG THX Rolando ..... It works. I add the server id entry to the mysld2 section and it works. it was very easy. sorry for my stupid questions. Have a nice day.... Commented May 30, 2012 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.