Mehic.info

Monitor live MySQL queries

Log to your mysql with

mysql -u username -pPassword

and execute:


mysql> SHOW VARIABLES LIKE "general_log%";

+------------------+----------------------------+
| Variable_name | Value |
+------------------+----------------------------+
| general_log | OFF |
| general_log_file | /var/run/mysqld/mysqld.log |
+------------------+----------------------------+

mysql> SET GLOBAL general_log = 'ON';

Then in another terminal execute

tail -f -n300 /var/run/mysqld/mysqld.log

Then don’t forget to disable general_log after you find the bug with

mysql> SET GLOBAL general_log = 'OFF';
Categories: Web