mysql 开启慢查询

时间:2023-03-09 04:32:04
mysql 开启慢查询

linux启用MySQL慢查询

vim /etc/my.cnf
[mysqld]
slow-query-log = on
slow_query_log_file = /var/log/slow_query.log
long_query_time = 3
log-queries-not-using-indexes = on # 列出没有使用索引的查询语句

  

Windows下开启MySQL慢查询

log-slow-queries = D:\log\mysql_low_query.log
long_query_time = 2

  

慢查询日志工具mysqlsla

mysqlsla -lt slow /var/log/slow_query.log