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 the log file of mysql

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

Share

Shulou(Shulou.com)06/01 Report--

How to view the log file of mysql? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

First, introduce the types of mysql logs. Generally speaking, there are five types of logs, which are:

Error log:-log-err (record the information that appears when starting, running, and stopping mysql)

Binary log:-log-bin (statement that records all changed data and is also used for replication and recovery of the database)

Query log:-log (records client connections established and statements executed)

Slow log:-log-slow-queries (records all queries executed in more than long_query_time seconds)

Update log:-log-update (binary log has replaced the old update log, which is no longer used in MySQL 5.1)

How to view the log:

1. Open cmd

Enter mysql-u root-p, and then enter the password to enter the database

2. Query the current log records

Mysql > show variables like 'log%'; (whether logging is enabled) mysql > show master status; (how to know the current log) mysql > show master logs; (shows the number of binary logs)

3. View the status of log function

From the figure above, you can see that the value value is in the status of off, indicating that the logging feature is not enabled.

Opening method:

Press the win+r shortcut key, enter services.msc, enter, open the service, and find the mysql service. View the location of the executable file.

4. Configure the my.ini file

Turn off the mysql service

Mysql > net stop mysql

Open the my.ini configuration file, add variables, and save.

Log=E:/mysql_log.txt

Then start the mysql service

Mysql > net start mysql

5. View the log

The contents of the log file are as follows:

MySQL's query log records the information of all MySQL database requests, regardless of whether they were executed correctly or not.

By default, MySQL query logs are turned off. In a production environment, if you turn on MySQL query logs, it still has a great impact on performance.

In addition, in many cases, the MySQL slow query log can basically locate those SQL with performance problems, which is a bit similar to profiler in SQL Server, but it cannot track a session, user, client, it can only track the entire database.

The answer to the question about how to view the log file of mysql is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

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