LowEndBox

Hosting Websites on Bare Minimum VPS/Dedicated Servers

How​ ​to​ ​fix​ ​a​ ​MySQL​ ​Failed​ ​to​ ​Start​ ​error

Tags: , Date/Time: November 8, 2017 @ 9:40 am, by Matt Zelasko

lowendtutorial

It’s 2 AM, you’re up late working on your website, and you find that your MySQL
database has gone offline. You log into your server to troubleshoot, and the following unpleasant
error message appears in your SSH terminal:

#​ ​service​ ​mysqld​ ​restart
Stopping​ ​mysqld:​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​[​ ​ ​OK​ ​ ​]
Timeout​ ​error​ ​occurred​ ​trying​ ​to​ ​start​ ​MySQL​ ​Daemon.
Starting​ ​mysqld:​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​[FAILED]

There are a number of issues that can lead to MySQL errors, and not one article can
cover the hundreds of possibilities that could cause a MySQL server to fail to start,
however, in this tutorial we will be covering the most common resolutions for this error.

Read more:

1. Configuration​ ​Errors We’ll start off with the most common issue – which is all
within one file on your server located at /etc/my.cnf. This is the file that is vital to
a successful MySQL server. This configuration file stores all of your MySQL
settings, if there are any errors or unsupported configurations in this
configuration, it can cause the MySQL server to fail to start.

2. Incorrect​ ​Permissions Check if proper permissions are in place! Permissions
of the MySQL files such as binaries or the ‘/var/lib/mysql’ folder can get
accidentally changed when multiple hands touch a server’s configuration.

3. MySQL​ ​port​ ​in​ ​use​ ​by​ ​another​ ​application​ ​– If another application on your
server is running on Port 3306 it can cause MySQL to fail to start.

4. Disk​ ​Space​ ​Full​ – Is your server disk space full? Or the /tmp partition full? If so,
this is why MySQL will fail to start as well. Check your disk space by running the
“df -h” command!

5. Out​ ​of​ ​memory​ – If MySQL process is not getting enough memory due to
abusive processes or any other valid process, it cannot start or would keep
crashing all the time.

These are the top 5 issues that can result to a MySQL server to not starting properly.
Go through each possibility, and chances are you’ll be on your way with a successful
MySQL start soon enough!

Are you facing an issue with starting MySQL on your server? Comment below, and our
community would be glad to help diagnose!

Special thanks to Julian Jin from AlphaRacks for sponsoring this tutorial.  

6 Comments

  1. Jarry:

    IMHO, out of these tips only 4 & 5 apply to situation when mysql has been running, suddenly stopped and can not be restarted (“your MySQL database has gone offline”). If you had problems with config, permissions or ports, mysql could never go offline because it could never start.

    Personally, if I have problem with some app/service, I start with checking logs before doing anything else. There should be clear indication for every of those problems mentioned above…

    November 9, 2017 @ 2:20 am | Reply
    • Great feedback, thanks Jarry :-)

      You’d be surprised though, when a server exchanges a lot of hands, especially with hands who aren’t familiar with the setup, or even worse, incompetent technicians messing up configurations, it happens more often than you think. We used to sell server management plans and almost 99% of the time MySQL failing to start errors was one of those five reasons.

      Julian

      November 9, 2017 @ 2:37 am | Reply
  2. This doesn’t really address anything beyond using basic common sense.

    For the given examples, the first four seem the most likely for an in-service-magically-stops issue.

    Also, “User-with-root migrates to MariaDB without understanding consequences” would be a pretty good weigh-in for #7, from what I’ve seen.. but those are usually immediately obvious, and only 2AM when designed to be done at 2AM ;)

    November 11, 2017 @ 8:05 pm | Reply
  3. S Bokhari:

    Hello Julian,

    I have not expected this quality of tutorial from LEB Team.
    Please add value to content like PRO, not like less than a basic user and sure, you people can do.
    I am a regular visitor to LEB. I am surprised after reading a couple of tutorials here.

    Hope you understand my point.

    Regards

    November 22, 2017 @ 4:02 am | Reply
    • Duly noted, and more advanced tutorials are in the works. I appreciate your insight, but remember not everyone is a server expert like you are! :-)

      I’m sure this article is highly helpful to those who are coming from search engines like Google too.

      Julian

      November 23, 2017 @ 12:26 am | Reply
      • S Bokhari:

        Hello Julian,

        Thank you for noticing it. I think 99.99% audience of LEB is professional because they are managing their Dedi or Virtual Servers and that is not an easy task at all. Sometimes, they raise such typical points in comments that surprises me.

        I am also an SEO expert, and if your audience reads and comments your articles then it raises your PA (page authority) and ranks well in Google.

        To engage LEB audience is only possible through GREAT articles, not even average as I have noticed. Big G (Google) knows our audience interest better than us and believe me this right by my experience.

        Thank you for your contribution.

        Regards

        November 24, 2017 @ 3:20 am | Reply

Leave a Reply

Some notes on commenting on LowEndBox:

  • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
  • Akismet is used for spam detection. Quoting webhostingtalk.com URL seems to get binned consistently here, but I do peek into the spam box frequently to publish those comments.
  • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

Your email address will not be published. Required fields are marked *