mysql> show variables like "%general_log%"; +------------------+-------------------------+ | Variable_name | Value | +------------------+-------------------------+ | general_log | OFF | | general_log_file | /data/mysql/mysql01.log | +------------------+-------------------------+ 2 rows in set (0.01 sec) mysql> set global general_log=on; Query OK, 0 rows affected (0.01 sec) mysql> select 1 from dual; +---+ | 1 | +---+ | 1 | +---+ 1 row in set (0.00 sec) mysql> show variables like "%general_log%"; +------------------+-------------------------+ | Variable_name | Value | +------------------+-------------------------+ | general_log | ON | | general_log_file | /data/mysql/mysql01.log | +------------------+-------------------------+ 2 rows in set (0.00 sec) mysql> set global general_log= off; Query OK, 0 rows affected (0.01 sec) mysql> select 1 from dual; +---+ | 1 | +---+ | 1 | +---+ 1 row in set (0.00 sec)
查看日志
[root@mysql01 ~]# tail -20f /data/mysql/mysql01.log /u01/mysql/bin/mysqld, Version: 5.7.35-log (MySQL Community Server (GPL)). started with: Tcp port: 3306 Unix socket: /data/mysql/mysql.sock Time Id Command Argument 2022-09-07T01:47:35.996451Z 2 Query select 1 from dual 2022-09-07T01:47:51.109988Z 2 Query show variables like "%general_log%" 2022-09-07T01:48:09.323441Z 2 Query set global general_log= off
标签:语句,set,log,sql,+---+,general,sec,mysql,日志 From: https://www.cnblogs.com/omsql/p/16664262.html