Search Our Database

How To Enable MySQL Query Log

Last updated on |
by

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:
log=/var/lib/mysql/mysql.log

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 @ sales@ipserverone.com