Home > Database > Mysql Tutorial > Detailed introduction of MySQL tracking SQL execution and opening slow query log

Detailed introduction of MySQL tracking SQL execution and opening slow query log

黄舟
Release: 2017-03-04 14:40:23
Original
1251 people have browsed it

Query slow query related parameters

show variables like '%quer%';

  • slow_query_log (whether Record slow query)

  • slow_query_log_file (slow log file path)

  • long_query_time (log will only be recorded after the set time)

Enable slow query log

(Linux) Add

 slow_query_log=TRUE
 slow_query_log_file=/usr/local/mysql/slow_query_log.txt
 long_query_time=3
Copy after login
## under the [mysqld] option of the /etc/my.cnf configuration file #(Windows) Add

 slow_query_log=TRUE
 slow_query_log_file=c:/slow_query_log.txt
 long_query_time=3
Copy after login

under the [mysqld] option of the my.ini configuration file. After restarting MySQL, re-query the relevant parameters to verify whether it is successfully opened

The above is the detailed introduction of MySQL tracking SQL execution and opening the slow query log. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!



Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template