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.
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.