


mysql日志开通,添加在my.cnf中即可,将路径修改为日志存放路径
普通日志设置方法:
慢日志设置方法,general_log = on
general_log_file=/filedir/mysql_general.log
log-slow-queries= /filedir/mysql-slow.log
long_query_time = 5
log-queries-not-using-indexes
设置后如果mysql重启失败,可用如下规则:
slow_query_log = ON
slow_query_log_file = /data/mysql-slow-yyc.log
long_query_time = 1
log-queries-not-using-indexes
查询日志开启情况
# 查询普通日志状态
show global variables like '%general%';
# 开启普通日志
set global general_log = on; // 打开
# 关闭普通日志
set global general_log = off; // 关闭
#查看是否有开启慢日志,登录到mysql执行如下命令
show variables like 'slow_query%';




亲爱的:若该文章解决了您的问题,可否收藏+评论+分享呢?
文章评论 本文章有个评论