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.