1. The configuration is enabled.Linux: In the mysql configuration file my. add log-slow-queries =/var/lib/mysql/slowquery in cnf. log (specify the location where the log file is stored, which can be null, the system will give a default file
How to enable slow query in MySQL
1. The configuration is enabled.
Linux:
Add
Log-Slow-queries =/var/lib/MySQL/slowquery. Log (specify the location where the log file is stored, which can be empty and the system will give a default file
MySQL Benefits:Easy to use, low cost, easy to expand, replication leadingThe life cycle of MySQL:MySQL server listener 3306 port > Authenticate Access user > create MySQL thread > Check memory (qcache) > Parse sql> generate query plan > Open Table >
Recently, a development team complained that our platform contains MySQL cluster not, always reported the MySQL "Heartbeat Error", analyzed the logs they collected, did not find the network between the MySQL cluster node problem, but found a very
Directory
I. Optimization Overview
Ii. query and index optimization Analysis
1. performance bottleneck locating
Show command
Slow query log
Explain analysis Query
Profiling Analysis Query
2 Index and Query Optimization
Iii. Configuration
Forwarding Original address: http://www.cnblogs.com/hanzhao1987/p/6100096.htmlMySQL Benefits:Easy to use, low cost, easy to expand, replication leadingThe life cycle of MySQL:MySQL server listener 3306 port > Authenticate Access user > create MySQL
A recent development team complained that our platform included MySQL cluster, and always reported MySQL's "Heartbeat Error". Analyzed the logs they collected. Did not find the MySQL cluster node network between the problem, but found a very
For most programmers, the most easily discovered and solved problem is MySQL's slow query or no indexed query, so here's how to use the official Mysqldumpslow tool to easily view this information. How to open a slow query for MySQL,MySQL Slow query
Open MySQL Slow query
MySQL Slow query log for tracking Php+mysql system under the MySQL load tuning problem is very useful, such as installing a lot of discuz! plug-ins users, so you can probably troubleshoot those plug-ins have code problems. In
Mysql has a function to log down and run slow SQL statements. This log is not available by default. To enable this function, modify my. cnf or add some parameters when mysql is started. If you modify it in my. cnf, add the following
The slow_query_log_file log becomes very large and it is inconvenient to analyze its input items. We want to generate a slow_query_log_file file every day and analyze the log file every day. How to cut by day? We have come up with this method to
From: http://parand.com/say/index.php/2009/09/01/finding-and-fixing-slow-mysql-queries/bar.html
Edit the my. CNF or my. ini file and remove the comments of the following lines of code:
log_slow_queries =
1. Install Mysqlsla
The code is as follows
Copy Code
wget http://hackmysql.com/scripts/mysqlsla-2.03.tar.gzTar zvxf mysqlsla-2.03.tar.gzCD mysqlsla-2.03Perl makefile.plMakeMake install
Perl makefile.pl will
MySQL has a function is log down to run the slower SQL statement, the default is not this log, in order to open this function, to modify the my.cnf or in the MySQL boot when the add some parameters. If you modify inside the MY.CNF, add the following
Enable slow Log
There are two ways to enable:
1, in MY.CNF through Log-slow-queries[=file_name]
2, when the mysqld process is started, specify the--log-slow-queries[=file_name] option
Five common tools for
Edit the MY.CNF or My.ini file to remove the comments from the following lines of code:
Copy Code code as follows:
Log_slow_queries =/var/log/mysql/mysql-slow.log
Long_query_time = 2
Log-queries-not-using-indexes
This
After the recent installation of MYSQL5 on a Linux server, local use of clients even the MySQL speed is very slow, local program connection is also very slow.Workaround: add skip-name-resolve under [mysqld] of the configuration file MY.CNF.
The
View status show VARIABLES like '%slow_query_log% 'Turn on set global show_query_log=1 (fail after reboot)Permanent effect Modification MY.CNF joinSlow_query_log=1Show_query_log_file=/var/lib/mysql/at-slow.logModify Time Threshold (default is
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.