This article is a mirror article of machine translation, please click here to jump to the original article.

View: 12299|Reply: 0

[Source] How to turn on slow query logging in Mysql

[Copy link]
Posted on 4/9/2015 3:56:44 PM | | |

MySQL slow query log is very useful for tracking problematic queries, it can analyze that there are very resource-consuming SQL statements in the current program, so how to open the mysql slow query log record?
      In fact, opening the slow query log of mysql is very simple, just add it to the [mysqld] in the mysql configuration file (Windows system is my.ini, Linux system is my.cnf).

  1. log-slow-queries=/data/mysqldata/slowquery.log
  2. long_query_time=2
Copy code


Notes:
/data/mysqldata/slowquery.log为日志存放的文件的位置,一般这个目录要有mysql的运行帐号的可写权限,一般都将这个目录设置为mysql的数据存放目录,long_query_time=2中的2表示查询超过两秒才记录




Previous:Benefits: Spend 20 minutes to earn 10 yuan, and there are only two opportunities a day, that is, 20 yuan...
Next:Easily teach you how to create XP+Linux+Win7 three-system tutorial
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com