mysql stopped suddenly, how to auto restart automatically?

Hi, it's happened since my first day migrating to my new vps account here.

Always got my mysql service stopped suddenly hence my wordpress site stopped running.

Firstly I would like to know, what causing this problem?

Which log should I check?

Then I would like to know how to solve this problem?

Thanks

5 Replies

Should I enable this logging option?

# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log   

As referenced from other discussion, I suggested to have crontab to start sql service.

55 5    * * *   root    service mysql status      || service mysql start

and run crontab -l

 no crontab for root 

yet the problem persists.

Thanks

Which log file will depend on your distribution but it'll be something like /var/log/mysql/mysql.log

As for monitoring I use monit http://mmonit.com/monit/ for this, it's in most package managers and can check that the process is running and that mysql is accepting connections, if it fails it restarts the service.

You should also check your syslog for out of memory errors, it's possible you're running out of memory the linux kernel is killing off mysql to recover ram.

Um…no. Wordpress is not all that hard to optimize. Many people run it (with a significant load) on just a 1G linode.

Maybe you should "heed" it as a sign you need to learn how to properly optimize web sites before throwing in the towel.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct