Here’s a simple trick for viewing MySQL queries as they hit your server – enable query logging to a file and then tail -f the file:
|
mysql> SHOW VARIABLES LIKE "general_log%"; |
|
+——————-+———————————–+ |
|
| Variable_name | Value | |
|
+——————-+———————————–+ |
|
| general_log | OFF | |
|
| general_log_file | /opt/local/var/db/mysql56/out.log | |
|
+——————-+———————————–+ |
|
2 rows in set (0.00 sec) |
|
|
|
mysql> SET GLOBAL general_log = 'ON'; |
|
Query OK, 0 rows affected (0.01 sec) |
|
tail -f /opt/local/var/db/mysql56/out.log |
Just be sure to turn it off when you’re done:
|
mysql> SET GLOBAL general_log = 'OFF'; |
Like this:
Like Loading...