stopping percona - "/etc/init.d/mysql stop" does not stop mysqld_safe

We are in the process of switching from mysql 5.5 to percona 5.6 on ubuntu 12.04. When I try to stop mysqld using the init.d script, it appears that mysqld_safe is not stopped and so it restarts mysqld.

I google’d for similar problems but have only found messages from 2010 and none are relevant. I have looked through the init.d script and it does not appear that there is ever an attempt to kill mysqld_safe. I have also looked for a setting in mysqld_safe to disable restarting mysqld but I have not been able to find anything.


I was able to track down that mysqld_safe is doing the correct thing. There is a while loop to restart mysql after a failed stop, but the trigger to exit is based on if the pid file still exists for mysqld or not. The /etc/init.d/mysql script does not remove the pid file after a successful stop so msyqld_safe is always restarting mysql. I am checking into why /etc/init.d/mysql is not removing the PID file. Anyone else run into this?

It appears that the init.d script is not supposed to remove the mysqld pid file. Instead mysqld should clean up it’s own pid upon successful exit. For some reason it was not when the pid file is in the default location (/var/run/mysqld/ I changed this to have the pid file in /tmp and it appears to be working now.

For me, on fresh install of Percona Server 5.6.14 on ubuntu 12.04, the init.d script does start/stop correctly and cleans the pid file. However, the default pid file for me is:
–pid-file=/var/lib/mysql/, hence it is owned by mysql user. Make sure the /var/run/mysqld catalog is also owned by mysql, and that should fix the issue. Or just use the same path as datadir.