[DataBase] MySql 查看实时日志

MySql 查看实时日志

-f 代表会实时读取该文件的更新内容

tail -f /usr/local/mysql/log/mysql.log

配置好日志

[mysqld]
log-error = /user/local/mysql/log/mysql.err

[mysqld]

控制是否开启常规日志

general_log=true

指定常规日志的文件路径

general_log_file=/usr/local/mysql/log/mysql.log

权限修改

➜  mysql git:(master) ✗ sudo chown  -R   _mysql ./log/
➜  mysql git:(master) ✗ sudo chgrp -R _mysql ./log/

数据库打开日志记录

mysql> show variables like 'general%';
+------------------+--------------------------------+
| Variable_name    | Value                          |
+------------------+--------------------------------+
| general_log      | OFF                            |
| general_log_file | /usr/local/mysql/log/mysql.log |
+------------------+--------------------------------+


mysql> set global general_log=on;


### 关闭日志记录
mysql> set global general_log=off;

posted @ 2020-03-20 17:11  ABeen  阅读(576)  评论(0编辑  收藏  举报