linux 上mysql慢日志查询

每日学习

我的是源码安装的 

首先找到mysql的my.cnf  

在 /etc/my.cnf

vim /etc/my.cnf

在里面加入以下三句话

slow_query_log=TRUE                                                 #开启慢日志  

slow_query_log_file=/home/mysql02/mysql/logs/slow_query_log.txt     #日志存放位置  

long_query_time=0.3                                                   #超时时间0.3(超过0.3秒就会被记录下来) 

 

写完之后保存 

打开mysql

show variables like '%quer%';

linux 上mysql慢日志查询

如果跟你设置的一样代表慢日志开启成功

每日学习总结