Home > Database > Mysql Tutorial > Linux下打开MySQL慢查询记录的配置方法

Linux下打开MySQL慢查询记录的配置方法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:54:11
Original
859 people have browsed it

Linux下启用MySQL慢查询MySQL在Windows系统中的配置文件一般是是my.cnf找到[mysqld]下面加上log-slow-queries=/data/mysqldata/s

MySQL慢查询记录日志对于跟踪PHP+MySQL体系下的MySQL负载调优问题很有用处,比如安装了很多Discuz!插件的用户,这样可以大概排查出那些插件有代码问题。其实启用MySQL的慢查询日志很简单,只需要在MySQL的配置文件里添加log-slow-queries和long_query_time两个参数即可。

Windows下开启MySQL慢查询

MySQL在Windows系统中的配置文件一般是是my.ini找到[mysqld]下面加上

log-slow-queries = F:\MySQL\log\mysqlslowquery.log

long_query_time = 2

Linux下启用MySQL慢查询

MySQL在Windows系统中的配置文件一般是是my.cnf找到[mysqld]下面加上

log-slow-queries=/data/mysqldata/slowquery.log

long_query_time=2

注意:

log-slow-queries = F:\MySQL\log\mysqlslowquery.log为满查询日志存放的位置,,一般这个目录要有MySQL的运行帐号的可写权限,一般都将这个目录设置为MySQL的数据存放目录;

long_query_time=2中的2表示查询超过两秒才记录

linux

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template