Whether logs are enabled
Mysql> show variables like 'Log _ bin ';
How to know the current log
Mysql> show master status;
Use mysqlbinlog to view binary log files
Shell> mysqlbinlog mail-bin.000001 (to write absolute problem path d ://)
Or shell> mysqlbinlog mail-bin.000001 | tail
Use a similar command in Windows.
Mysql has the following types of logs:
Error log:-log-err
Query log:-log
Slow query log:-log-slow-queries
Update log:-log-update
Binary log:-log-bin
In the installation directory of mysql, open my. ini, add the above parameters to the end, save and restart the mysql service.
For example:
# Enter a name for the error log file. Otherwise a default name will be used.
Log-error = err. log
# Enter a name for the query log file. Otherwise a default name will be used.
# Log =
# Enter a name for the slow query log file. Otherwise a default name will be used.
# Log-slow-queries =
# Enter a name for the update log file. Otherwise a default name will be used.
# Log-update =
# Enter a name for the binary log. Otherwise a default name will be used.
# Log-bin =
Only error logs are enabled. To enable other logs, remove the preceding.
Long_query_time = 1 -- indicates how long the SQL statement will be logged after execution. Here, it is 1 second.
Log-slow-queries = slowqueris. log -- Records slow statements returned by the query.
Log-queries-not-using-indexes = nouseindex. log -- it is a literal meaning that the query with no index is used in the log.
Log = mylog. log -- Record all execution statements
Log-error = log-error.log
Log = log-query.log
Log-queries-not-using-indexes
Log-warnings = 2
Log-slow-queries = log-slow-query.log
Log-update = log-update.log
Long_query_time = 2
From the blog of OO & XX