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:

[mysqld]
user            = mysql
socket          = /var/run/mysqld/mysqld.ip.ip.ip.ip.sock
port            = 32866
datadir         = /var/lib/mysql.ip.ip.ip.ip
server-id=18861
master-host=ip.ip.ip.ip
master-connect-retry=60
master-user=repluser
master-password=*******
        replicate-do-db=spring_salast

[mysql.server]
basedir=/var/lib/mysql.ip.ip.ip.ip
link|improve this question

What do you mean by "still controlling" - can you expand on the behavior that you're seeing? – Shane Madden Jan 25 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 at 7:19
feedback

1 Answer

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

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

I think you get the idea.

link|improve this answer
The socket parameter has been defined. Please check the conf file included in the question. – gAMBOOKa Jan 25 at 7:40
1  
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 at 7:44
feedback

Your Answer

 
or
required, but never shown

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