How to enable and view logs in MYSQL
This article introduces you how to enable and view the log in MYSQL, the content is very detailed, interested friends can refer to, I hope it can be helpful to you.
Use mysqlbinlog.exe to view binary logs
[@ more@]
Whether logging is enabled
Mysql > show variables like 'log%'
How to know the current log
Mysql > show master status
Look at the binary log files using mysqlbinlog,mysqlbinlog.exe is a viewing tool that comes with the bin directory after mysql is installed.
Shell > mysqlbinlog mail-bin.000001
Or shell > mysqlbinlog mail-bin.000001 | tail
Use a similar command under Windows.
Mysql has the following types of logs:
Error log:-log-err
Query log:-log
Slow log:-log-slow-queries
Update log:-log-update
Binary log:-log-bin
In the mysql installation directory, open my.ini, add the above parameters, 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=
# 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 the error log is opened above. If you want to open other logs, remove the previous "#".
Long_query_time = 1-- refers to how long the sql will be executed by log, which is 1 second.
Log-slow-queries=slowqueris.log-returns the query to slower statements for recording
Log-queries-not-using-indexes = nouseindex.log-literally, query that does not use an index under log
Log=mylog.log-record all execution statements
On how to enable and view the log in MYSQL to share here, I hope the above content can be of some help to you, you can learn more knowledge. If you think the article is good, you can share it for more people to see.