打印全部日志
最后更新于:2022-04-02 03:55:55
[TOC]
## 开启全局日志
### 临时
查询
```
mysql> SHOW VARIABLES LIKE 'general%'; //查看是否开启
+------------------+------------------+
| Variable_name | Value |
+------------------+------------------+
| general_log | ON |
| general_log_file | /var/log/mysql/general_log.log |
+------------------+------------------+
```
开启
```
mysql> SET GLOBAL general_log='ON'; //开启
mysql> SET GLOBAL general_log_file = '/var/log/mysql/general_log.log'; // 设置目录
```
### 永久
my.cnf
```
general_log = 1
general_log_file = /var/log/mysql/general_sql.log
```
';