Quick Reading Why do we need to monitor SQL statements, how to monitor them, and what are the ways to monitor them. We know that there is a tool called SQL Profile in SQL Server, which can monitor the SQL statements executed in SQL Server in real time to facilitate debugging bugs or confirm the final generated SQL statements. Why monitor SQL statements?
How to monitor sql statements in mysql? By default, MySQL does not enable SQL statement monitoring. When it needs to be enabled, execute the following command. SHOW VARIABLES LIKE "general_log%"; -- off means off, if it is on, it has been turned on SET GLOBAL general_log = 'ON'; --Turn on log monitoring. I have it turned on. If it is not turned on, general_log will show off. As shown in the figure below, you can see the default path where the log is saved.
Next we execute a few sql statements to check Execute SQL SELECT * FROM `platform` UPDATE `platform` SET platform_type=2 WHERE id=1 Next, let’s look at the log. You can see that the log contains
Corresponding to time, id, command, and parameter respectively Parameters refer to the SQL statements that are executed. How to display the SQL statement in MySQL in the table It is inconvenient to view in the log, what if the SQL statement is displayed in a table in the database? Execute the following sql SET GLOBAL log_output = 'TABLE'; SELECT * FROM mysql.general_log ORDER BY event_time DESC Display with processlist USE `information_schema`; SELECT * FROM PROCESSLIST WHERE info IS NOT NULL; It is said that this method can be displayed in real time, but I don’t know why the new SQL cannot be displayed in real time. I will record it first. Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. You may also be interested in:
|
>>: Detailed explanation of the complete usage example of developing hyperf under Docker
Copy code The code is as follows: <select> ...
Table of contents 1. Select database USE 2. Displ...
Experimental environment: Physical machine Window...
Samba Overview Samba is a free software that impl...
Detailed explanation of tinyMCE usage initializat...
Document Scope This article covers mode switching...
webkit scrollbar style reset 1. The scrollbar con...
background PNG images take up more storage space ...
<meta name="viewport" content="w...
Introduction As mentioned in the previous article...
First, download the diagram 1. First uninstall th...
Function currying (black question mark face)? ? ?...
Table of contents Written in front 1. Ngixn image...
html ¶ <html></html> html:xml ¶ <h...
Recently, Oracle announced the public availabilit...