MySQL Server version: 5.5.43-0ubuntu0.14.04.1 (Ubuntu)

Ubuntu-Server 14.04 LTS

Default MySQL-Config-File


Even after spending a long time I can not figure out why I can not start mysqld through mysqld_safe.

MySQLDocs are stating that:

mysqld_safe is the recommended way to start a mysqld server on Unix and NetWare. mysqld_safe adds some safety features such as restarting the server when an error occurs and logging runtime information to an error log file.

Furthermore I understand that mysqld_safe is some kind of a wrapper around mysqld. When invoking mysqld_safe it will try to start mysqld.

How to invoke mysqld_safe?

There is no init-script in /etc/init.d named mysqld_safe. Only a script named mysqld.


sudo service mysqld start

passes start directly to /etc/init.d/mysqld. Where in /etc/init.d/mysqld it would jump to case start executing:

 # Start MySQL!
 /usr/bin/mysqld_safe > /dev/null 2>&1 &

But is mysqld_safe now running or not?

ps -aux | grep my gives following output:

mysql    31168  0.0  4.2 318348 43648 ?        Ssl  14:35   0:03 /usr/sbin/mysqld

and not

mysql    31168  0.0  4.2 318348 43648 ?        Ssl  14:35   0:03 /usr/sbin/mysqld_safe


How can I start mysqld through mysqld_safe as I want to do the right way and not the lazy way like ''Ah, forget it.. at least it is working''.

I want to learn something..


mysqld_safe is "angel" process which monitors MySQL and restarts it when it fails.

That way it was implemented originally. Some distributions now starts managing the processes itself and do not start mysqld_safe.

In Ubuntu 14.04 you may be able to to run sudo /etc/init.d/mysql start instead of sudo service mysql start for some mysql forks to be able to run mysqld_safe. (i.e. some options, for example jemalloc was using mysqld_safe).


mysqld_safe is just a script to start up the mysqld daemon. It exits as soon as the daemon is up and running, that is why you don't see mysqld_safe running with ps. You would see it, though, if you were very fast.

  • 1
    Sure? Isn't mysqld_safe something like a monitoring program monitoring mysqld... which gives better recovery in case that mysqld exits abnormally? If so then it has to be an own process! Do I miss something? – Mike Jun 16 '15 at 14:44
  • No, there is no continuous monitoring in mysqld_safe. As I said, it performs a large number of checks, starts up the server, and then exits. To see for yourself, you could modify the script to notify you at the exit points. – Jos Jun 17 '15 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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