色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

mysql查看日志的所有方法

榮姿康2年前11瀏覽0評論

MySQL的日志非常重要,可以幫助我們發現數據庫的問題并進行調試。下面我們來介紹一些查看MySQL日志的方法:

1. 查看MySQL錯誤日志

shell>sudo tail -f /var/log/mysql/error.log

2. 查看MySQL慢查詢日志

mysql>show variables like '%slow_query_log%';
+---------------------+--------------------------------------+
| Variable_name       | Value                                |
+---------------------+--------------------------------------+
| slow_query_log      | ON                                   |
| slow_query_log_file | /var/log/mysql/mysql-slow.log        |
+---------------------+--------------------------------------+
1 row in set (0.00 sec)
shell>sudo tail -f /var/log/mysql/mysql-slow.log

3. 設置MySQL慢查詢閾值

mysql>set global slow_query_log = 1;
mysql>set global long_query_time = 5;

4. 查看MySQL二進制日志

shell>sudo tail -f /var/log/mysql/mysql-bin.log

5. 查看MySQL查詢日志

mysql>show variables like '%general_log%';
+------------------+--------------------------+
| Variable_name    | Value                    |
+------------------+--------------------------+
| general_log      | OFF                      |
| general_log_file | /var/log/mysql/mysql.log |
+------------------+--------------------------+
1 row in set (0.00 sec)
mysql>set global general_log = 1;
mysql>show variables like '%general_log%';
+------------------+--------------------------+
| Variable_name    | Value                    |
+------------------+--------------------------+
| general_log      | ON                       |
| general_log_file | /var/log/mysql/mysql.log |
+------------------+--------------------------+
1 row in set (0.00 sec)
shell>sudo tail -f /var/log/mysql/mysql.log

以上是MySQL查看日志的方法,可以根據具體需求選擇合適的方式。