Search Our Database

How To Enable MySQL Query Log

Last updated on |

It is best to enable MySQL query log so that you can backtrack your codes and steps for troubleshooting purposes. To do so, you will need to edit your MySQL configuration file.

Step 1 – Login into your web server via SSH.

Step 2 – Edit your MySQL configuration file by running the following commands.

vi /etc/my.cnf
#add in this line:

Step 3 – Restart your MySQL service.

/etc/init.d/mysqld restart

You can now use commands such as tail command to trace your codes and steps from the log file.

tail -f /var/lib/mysql/mysql.log

However, remember to disable the log after troubleshooting. Else, the log file may grow over time and take up space in your web server.


Affordable but Powerful Cloud Hosting Package

Check out IPServerOne’s Cloud Hosting Packages.
Contact us @ +603-6259-5625 or email @