Crashes database and MySQL failed to start,

June 6, 2016 581 views
WordPress Linux Commands


there is an error in database that can't restart,
the command "sudo service MySQL start" always failed,

the database crashed when I tried to optimize a table,
there is 5 websites down now,

can you please support?


3 Answers

What does the log say?

  • the command: less /var/log/mysql/error.log return this
    14:08:00 InnoDB: ERROR: the age of the last checkpoint is 9447540,
    InnoDB: which exceeds the log group capacity 9433498.
    InnoDB: If you are using big BLOB or TEXT rows, you must set the
    InnoDB: combined size of log files at least 10 times bigger than the
    InnoDB: largest such row.

    • Can you please include the entire log file? Or at least the last hundred lines or so.

There are a couple of potential issues so you may need to do some diagnostic work to determine which it is.

First ensure that any stale processes of mysqld aren't running using ps aux | grep mysql and killing them off if necessary.

Then without more information it is very likely that you may need to run a repair on your tables and then attempt to restart mysql:

myisamchk --safe-recover --force --sort_buffer_size=2G --key_buffer_size=2G /var/lib/mysql/*/*.MYI

This is assuming that your mysql databases are stored in /var/lib/mysql.

Then when you attempt to restart, hopefully things work, if not check where your mysql error log resides and tail it to see if there are any more detailed error messages that are present. It maybe related to a corrupt table, broken permissions, or perhaps a socket connection that isn't being initialized appropriately.

Hopefully though the myisamchk will fix things up for you and you'll be able to restart without any further issues.

  • Looks like innodb tables, not myisam tables, so I'm not sure myisamchk will be effective

For the innodb issue that you mentioned it's most likely because you have some text or blob fields inside of your database that are too large given the settings for your MySQL sever and they need to be tuned so that you can parse your transaction logs.

To do this you will want to review your /etc/my.cnf variables and tune them up.

Specfically the following:

innodb_log_buffer_size          = 64M
innodb_buffer_pool_size         = 1G
innodb_log_file_size            = 512M

Though you may want to check your defaults and scale from there, by using a factor of 4x.

Then you want to make sure that any running transactions have been processed from your existing logs to do that you will want to force them to be written:

mysql -uroot -p -e"SET GLOBAL innodb_fast_shutdown = 0;"

If your MySQL server isn't running that will probably fail, so you can proceed to the next step, which is either to delete or move your existing logs. If you are worried you have unprocessed transactions you can just move them otherwise:

service mysql stop
rm -f /var/lib/mysql/ib_logfile*

Now that you've updated your mysqld settings for your innodb logs you can restart mysql:

service mysql start

And the service should start up just fine. If the earlier attempt to set innodbfastshutdown failed you will want to do it again now so that future shutdowns commit all transactions:

mysql -uroot -p -e"SET GLOBAL innodb_fast_shutdown = 0;"

Now hopefully everything is back up and running for you.

  • Hi,

    thanks for your attention,

    the system deny to give me permission to my.cnf,

    can you please fix the issue with charge of course?

    the mysql crashed when i tried to repair or optimize a database,
    it is installed by ServerPilot service,


    • You will need to be the root user or use sudo to edit /etc/my.cnf - then you should be all set.


Have another answer? Share your knowledge.