Mysql database error due to server full disk

Because of the occupation of some large files on the server, there were a few times that the disk and the database went wrong, and the database could not be restarted after deleting the extra files. All database-related services reported errors and failed to start, such as WordPress database connection error, Nextcloud 500 error, etc.

IMPORTANT: After the disk is full, please do not restart the server or database service immediately. You should clear the disk space first, let the database service writes the cache, and then shut down or restart it! If you restart directly, it will cause such an error as I mentioned.

The following content is for reference only, please fix it according to your own error situation.

  1. First check whether your server disk has enough space cleared, and use commands such as df -h and du -h to check.
  2. Check whether the space is occupied by some large log files. Common check locations include syslog and /var/log/nginx, etc., depending on your installation situation.
  3. Try to start mysql, get an error report, the location is generally located in /var/log/mysql/error.log
  4. Check the error report, if it’s an error due to the similar reason, it will show something like:

The key to the problem lies in the inability to initialize the tc.log file.

So the solution is to delete the existing tc.log file (empty currently), and then restart the mysql service. tc.log is usually located in /var/lib/mysql/

It will automatically generate a new tc.log file, so that mysql can start normally, and the problem is solved!

 

translated 2021-09-24

Leave a Reply