How To Access MYSQL Database Error Log Files Server Side

Access MYSQL Database Error Log Files

MySQL Error Log Files


YSQL Database Error Log Files Access: The MySQL Database crash is the worst nightmare for every web designer. If the MYSQL has been crashed and then you need to restart the Server’s DB from your Database backup. If you have a good backup of DB means, retrieving will be possible otherwise you lose your complete backup. We suggest you maintain your backup DB on AWS, Azure or Google Cloud services. They have their own DB based services and they are very good at DB backup.

Jump To:

You can find the reason that causes the DB to crash through the error log files. If you don’t know how to access the error log files of your MYSQL database and then follow the below steps to access the error log files of your MySQL Database.

Access Error Logs of MySQL DB on Ubuntu Server:

$sudo less /var/log/mysql/error.log

The default location of MySQL in Ubuntu server is  /var/log/mysql/error.log . The error files can be easily read by using the ” less ” command with the MySQL location. From the log files, you may get the information which causes the MySQL to crash. You can fix the MySQL Table by following the below steps.

How to Fix MySQL Table Crash:

The MySQL can be crash but, occasionally. Which may lead to unable to access the data items from the MySQL tables. Don’t try hard to access your crashed DB which may lead to your server crash.

Check this too  {Latest} Configure Static IP Address On Ubuntu 18.04 LTS- How To?

Common Causes for crashed tables:

  • The MySQL server stops in the middle of a write.
  • There’s a software bug somewhere in the MySQL code.
  • The computer hardware fails.
  • The machine is shut down unexpectedly.
  • An external program modifies a table that’s simultaneously being modified by the server.
You just need to take the backup of your DB before trying to fixing your DB or troubleshooting your DB

Stop the MySQL Service:

$sudo systemctl stop mysql

The above command will shut down your MySQL table.

Backup your MySQL DB:

$cp -r /var/lib/mysql /var/lib/mysql_bkp

The above command will copy your DB completely to the new DB file. Once the backup has done and then you need to initiate the troubleshooting.

Troubleshooting MySQL DB:

You can simply check your DB has been corrupted or nor by using the “CHECK Table” command.

mysql>CHECK TABLE table_name;

A popup will appear on your screen and it will tell you whether your MySQL DB is corrupted or not. If your table is corrupted and you can fix the table by using the following command.

mysql>REPAIR TABLE table_name;

The below output will appear on your screen if the repair has successfully done.


| Table                       | Op        | Msg_type | Msg_text      |

| database_name.table_name | repair    | status      | OK |

Restart your MySQL DB:

$sudo systemctl restart mysql

Once the troubleshooting process has been completed, Restart your DB and then your MySQL DB will work as usual.

Check this too  NSlookup Command Linux: Essential 10+ nslookup Command Examples


In this article, we provided the information about accessing the Log files of your MySQL DB and troubleshooting it. If you have any query feel free to comment us below.

What do you think?

Upvote Downvote
  • Command Working
  • Article Explanation


For more article, Kindly visit our HomePage

Leave a Reply

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

Written by Jim Moriarty

Hello, Am Jim from Arizona, Big Fan of Holmes. Server-side handler, Network Engineer & currently working for Tec Robust. I write a server-based article.

Contact me:
tecrobust [@]
Sub: Message to Jim.


How To Install PHP-7.2 CURL On Ubuntu 18.04, 18.04.2 & 19.04 Edition

Micropad on Ubuntu 19.04

Install Micropad on Ubuntu 19.04/ 18.04.2 LTS & other Linux Distros