I'm having trouble restarting mysql. When I enter the following command, I get this message:

# /etc/init.d/mysql restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the restart(8) utility, e.g. restart mysql

And it hangs forever.

When I try to restart mysql as a service using the following command:

# service mysql restart

It hangs forever.

I can't log into mysql as root anymore either. Any ideas on how to get this running again?

I tried the following

# service mysql start
start: Job is already running: mysql

When I do the following

# ps -ef | grep -i mysql | grep -v grep

Nothing gets returned

  • Please check if your disk is not full
    – Sergei
    Jan 2, 2012 at 20:29
  • The disk is not full
    – user784637
    Jan 2, 2012 at 20:30
  • Did you try a reboot? Maybe hangs the pid file? Jan 2, 2012 at 21:00
  • I already tried rebooting the server. Same problem still
    – user784637
    Jan 2, 2012 at 21:05
  • uninstalling and reinstalling mysql worked for me: apt-get remove mysql-server, apt-get autoremove, apt-get install mysql-server
    – xinthose
    Jun 13, 2017 at 18:25

2 Answers 2


Check the MySQL logs in /var/log or possibly in /var/lib/mysql.

My bet is that the reason it "hangs" is because its doing a repair of some sort on tables that could have gotten corrupted. I've seen "mysql" take 20 minutes or longer to "start"... How long have you given it before assuming it's "hung"?

See if the logs indicate anything. Also, after starting mysql once, try running this to verify MySQL is, in fact, running:

ps aux | grep mysql
  • Thanks for your suggestions, but look at the last line I wrote with the ps -ef, nothing gets returned even after I 'start' mysql
    – user784637
    Jan 2, 2012 at 20:51
  • Have you checked the logs?
    – David W
    Jan 2, 2012 at 20:54
  • Yah, nothing special
    – user784637
    Jan 2, 2012 at 20:58
  • Where can I can the mysqld.sock? It's missing from /var/run/mysqld
    – user784637
    Jan 2, 2012 at 21:01

The best way to debug this type of thing is to directly run

sudo mysqld

That's the only way to see startup errors. (For some reason, they aren't written to any of the mysql logs). Often you can see it's failing to load a binlog or having problems getting to a certain directory.

  • 1
    You sure that sudo belongs there?!
    – Bobby
    Jul 11, 2012 at 9:20
  • running this without sudo will give you more accurate feedback unless you are launching mysqld as sudo. MySQL has global and user specific settings, so sudo would only give you information for the root user.
    – Tisch
    Feb 27, 2016 at 15:11
  • I was trying to restart mysql but could not do so as the secure path mentioned in the config was not there. only this command could tell me the real problem. Apr 5, 2021 at 14:27

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.