Debugging web pages using MySQL

Tags:

mysql> <span style="text-decoration: underline;">show variables like '%log%';
</span>+-------------------------------------+---------------------------------+
| Variable_name                       | Value                           |
+-------------------------------------+---------------------------------+
| back_log                            | 50                              |
...
| general_log                         | OFF                             |
| general_log_file                    | /var/run/mysqld/mysqld.log      |
...
| log                                 | OFF                             |
| log_bin                             | OFF                             |
...
| log_error                           | /var/log/mysqld.log             |
| log_output                          | FILE                            |
...
| slow_query_log                      | OFF                             |
| slow_query_log_file                 | /var/run/mysqld/mysqld-slow.log |
| sql_log_bin                         | ON                              |
| sql_log_off                         | OFF                             |
| sql_log_update                      | ON                              |
| sync_binlog                         | 0                               |
+-------------------------------------+---------------------------------+
40 rows in set (0.00 sec)

mysql> <span style="text-decoration: underline;">SET GLOBAL general_log = 'ON';</span>
^Z
$ <span style="text-decoration: underline;">sudo less /var/run/mysqld/mysqld.log</span>
... (log entries scroll) ...
$ <span style="text-decoration: underline;">fg</span>
mysql> <span style="text-decoration: underline;">SET GLOBAL general_log = 'OFF';</span>
mysql> QUIT;
$