Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two instances of mysql running on a server. I need two different init.d scripts. The two instances have different configuration files /etc/my.cnf and /etc/my-slave.cnf. I copied the /etc/init.d/mysql files to /etc/init.d/mysql-slave and changed the conf parameter to /etc/my-slave.cnf but the mysql-slave service is still controlling the first instance of mysql. The my-slave.cnf configuration file is as follows:

user            = mysql
socket          = /var/run/mysqld/mysqld.ip.ip.ip.ip.sock
port            = 32866
datadir         = /var/lib/mysql.ip.ip.ip.ip

share|improve this question
What do you mean by "still controlling" - can you expand on the behavior that you're seeing? – Shane Madden Jan 25 '12 at 7:04
service mysql-slave start|stop|restart will start, stop and restart the first instance of mysql. The one with configuration file /etc/my.cnf – gAMBOOKa Jan 25 '12 at 7:19

Your MySQL instances are controlled by mysqladmin (from inside /etc/init.d/mysql-slave). Mysqladmin it have --defaults-file= ... where you will find socket option (at what instance should connect). You need to change the socket option in both mysql-slave.cnf and in the default file.

socket = /var/run/mysqld/mysqld-slave.sock

I don't know what distribution you are running, but if you do not have a default file then you should specify one. Debian default file it looks like

host     = localhost
user     = debian-sys-maint
password = xxxx
socket   = /var/run/mysqld/mysqld.sock

I think you get the idea.

share|improve this answer
The socket parameter has been defined. Please check the conf file included in the question. – gAMBOOKa Jan 25 '12 at 7:40
but not for mysqladmin. mysqladmin it will get the standard mysql.cnf file. Search in /etc/init.d/mysql-safe after mysqladmin and see if it have --defaults-file defined. If is defined, then look in that file and modify socket option. If not you should specify the default file as /etc/mysql-slave.cnf – Sacx Jan 25 '12 at 7:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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