In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Let's talk about what are the common categories of log files in MySQL. The secret of the text is that it is close to the topic. So, no gossip, let's go straight to the following, I believe you will benefit from reading this article on the classification of common log files in MySQL.
Log is very important for a system or application. When troubleshooting or troubleshooting, the first time is to look at the error log.
First, MySQL log classification: log files record various types of activities that affect the database, and common log file classifications in MySQL databases.
Error log (Error log)-if the log does not exist, flush logs will card the owner. If you want to back up the error log, you must create a new one and grant permission to execute flush logs.
Slow log (Slow query log)-if the log does not exist, flush logs will prompt that the log file does not exist and will not be created. If you want to back up the slow log, you must create a new one and grant permission to execute flush logs.
Binary log (binary log)-generate a new binary file
Query log (general_log)-if it does not exist, mysql will automatically generate a
Note: for the above logs, when flush logs is executed, the mysql instance will close and reopen the log file.
Second, error log detailed explanation: MySQL error log records serious warnings and error messages during the operation of MySQL, as well as detailed information of each time MySQL starts and shuts down.
[view the location where the MySQL database error log is stored]
Mysql > show variables like 'log_error'
+-+ +
| | Variable_name | Value |
+-+ +
| | log_error | / var/log/mysqld.log |
+-+ +
1 row in set (0.01 sec)
My.cnf
There are some differences in log-error=/var/log/mysqld.log-or mysql instances
Simulation error log:
Third, slow query log
Note: although the name of the slow query only contains "query", it actually means not only SELECT query operations, such as INSERT, UPDATE, DELETE, CALL and other DML operations, as long as they exceed the specified time, can be called "slow query" and will be recorded in the slow query log.
Parameters related to the slow query log:
Slow_query_log=on | whether to enable slow log in off #
Slow_query_log_file=filePathAndName; # specifies the path and file name of the slow log file, which is located in the data directory by default
Long_query_time=5 # specifies how many seconds a statement that does not return a result records the log, that is, it is considered a slow query after that time
Log_queries_not_using_indexes # records all queries that do not use the index
Min_examined_row_limit=1000 # records slow queries caused by more than 1000 queries
Log_slow_admin_statements # records slow OPTIMIZE TABLE, ANALZE TABLE, and ALTER TABLE statements. Because these statements themselves will execute the query, such as alert table will first query out and then modify.
Log_slow_slave_statements # records slow queries generated by slave
Log_output=FILE | TABLE # if you select table select * from mysql.slow_log
Set the parameters:
Set @ @ global.log_output='FILE'
Set global log_output='TABLE'
Select @ @ log_output
Select @ @ global.log_output
Show global variables like 'log_output'
Show variables like 'log_output'
Simulate slow query log: select sleep ()
Is there anything else you don't understand about the above MySQL common log file categories? Or if you want to know more about it, you can continue to follow our industry information section.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.