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';
设置完之后可以看到/var/run/mysqld/mysqld.log有实时的sql。
不用之后记得设置成off 。
-
mysql> SET GLOBAL general_log = 'OFF';