1、修改 mysql 的配置文件 my.cnf:

 

2、在 [mysqld] 中添加内容:

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

 

3、登录 mysql 客户端,查看 slow_query_log 变量:

show variables like '%quer%';

 

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:23 天前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐