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 view logs in mysql

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Today, I will talk to you about how to view the log in mysql. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

Whether logging is enabled

> show variables like 'log_bin'

How to know the current log

Mysql > show master status

Look at the binary log file using mysqlbinlog

Shell > mysqlbinlog mail-bin.000001 (to write the absolute problem path dazzle /)

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=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 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

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

After reading the above, do you have any further understanding of how to view logs in mysql? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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