Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to enable and view logs in MYSQL

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report