Overview of MySQL log files

Source: Internet
Author: User
Tags mysql database

The log files described here are files of the MySQL database itself, regardless of what storage engine is specifically used.

Error log

MySQL's error log is similar to Oracle's Alert.log, which ends with. Err by default, and the DBA should first query the log for an error message when it encounters a problem.

Query log

The query log records all database requests, and these requests are not properly executed.

Slow query log

The slow query log is used to record SQL statements that run longer, and can be set by parameter long_query_time. By default, MySQL does not start a slow query log, you can start it by setting log_slow_queries for on.

Another parameter associated with the slow query log is log_queries_not_using_indexes, which means that if the SQL statement that is running does not use an index, it is logged to the slow query log.

The slow query log is primarily used to assist DBAs in optimizing SQL statements.

Binary log

The binary log records all changes to the database (select and show are not included), the binaries are not started by default, and you need to manually specify the parameters to start.

Binary logs have the following two main functions:

1) Recovery (recovery): When a database is recovered from a fully-prepared file, we can recover point-in-time through binary logs.

2) Replication (replication): It can be used to implement real-time synchronization from the database.

The ability to turn on binaries affects performance (the ability to open binaries to reduce database performance by about 1% per cent according to official documentation), but these performance losses are acceptable, given the benefits.

Related Article

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.