Checking error log file is one of the first things we do when a server needs a debug. When these bugs find their way to databases, the MySQL error log file will be one of the those that you need to check multiple times.
Today I want to share with you a simple way that you can print out the MySQL error log of your Linux server.
For this tip you need to have SSH access to the server. The way you can connect to the server via SSH is easy. You just need to open a terminal and press enter after typing this command:
$ ssh root@SERVER_IP
SERVER_IP with the IP of your server.
After pressing the enter key, you will be asked about the server password. Note that this is the password of your VPS/Server not the database.
Tip: If you didn’t see anything on the command line while typing your password, don’t worry. Just type the password and press enter. It will take a few seconds to connect to the server via SSH protocol.
When you are connected, you can simply add this command and by pressing enter, the MySQL error log will be traced. The mysql query error log is:
# less /var/log/mysql/error.log
Please note that this command requires root access. So, if you’re not logged into the server as root, you need to use
sudo with the command just like this:
$ sudo less /var/log/mysql/error.log
MySQL error log location in Ubuntu and Debian are the same. You can use this command for both.
If you find this article helpful, feel free to share this page with your mates and friends. Maybe some of them find it useful for their tasks too.