Mysql:general_log log, database thread query, database slow query

Source: Internet
Author: User

Opening the general log will log all SQL statements that arrive at MySQL server. Generally does not open the function, because the amount of log can be very large. However, in some cases, the general log may be temporarily opened for use by a barrier.
The relevant parameters are 3:general_log, Log_output, General_log_file

Show variables like ' General_log '; --Check if the log is open
Show variables like ' log_output '; --Look at the Log Output type table or file
Show variables like ' general_log_file '; --look at where the log files are saved
Set global general_log_file= ' TMP/GENERAL.LG '; --Set the location where the log files are saved
Set global general_log=on; --Turn on log function

Set global log_output= ' table '; --Set the output type to table
Set global log_output= ' file '; --Set Output type to file

Database thread

Show Processlist; --View current database thread status

Slow query

Show variables like "%slow%"; //View slow query settings

Set slow_query_log=' on '; //Enable slow query

Set global long_query_time=2; //Set to 2 seconds, plus global, the next time you enter MySQL is already in effect

Reference: http://blog.csdn.net/zyz511919766/article/details/49335949
http://renxiangzyq.iteye.com/blog/835397

Http://blog.51yip.com/mysql/972.html

Mysql:general_log log, database thread query, database slow query

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.