linux下开启mysql慢查询日志

修改mysql的配置文件my.cnf  

【 vi /etc/my.cnf】

在[mysqld]里面加上以下内容

linux下开启mysql慢查询日志_第1张图片


slow_query_log=TRUE      											#开启慢日志
slow_query_log_file=/home/mysql02/mysql/logs/slow_query_log.txt    	#日志存放位置
long_query_time=5													#超时时间5秒(超过5秒就会被记录下来)

重启 mysql 服务器 


登录msql 

show variables like '%quer%';

linux下开启mysql慢查询日志_第2张图片

这样慢日志就开启成功了。


参考:http://blog.51yip.com/mysql/972.html

    http://blog.sina.com.cn/s/blog_6fd605b50100q5es.html 

            https://jingyan.baidu.com/article/0aa223755476db88cc0d6492.html

你可能感兴趣的:(linux)