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

vi /etc/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%';

相关文章:

  • 2021-12-14
  • 2022-12-23
  • 2021-06-23
猜你喜欢
  • 2021-11-10
  • 2022-02-14
  • 2022-02-04
  • 2021-10-07
  • 2021-12-08
  • 2021-10-03
相关资源
相似解决方案