Open the My.ini file, under the location installation directory, add an open log configuration, restart MySQL
# SERVER section#----------------------------------------------------------------------# # The following options would Be read by the MySQL Server. Make sure that# you have installed the server correctly (see above) so it reads this # file.#[mysqld]# Set Slow Query LOGL Ong_query_time = 1slow_query_log = 1slow_query_log_file = "Slowquery.log" #Set general Loglog = "Genquery.log"
Slow_query_log_file, log file location can make an absolute path, default in the Data folder.
Long_query_time units are seconds, which means that query statements greater than 1 seconds are recorded in the Slowquery.log file.
Log is the executed SQL statement that will be recorded.
As follows:
150315 12:06:20 2 Query SET profiling=1 2 Query SHOW STATUS 2 Query SHOW STATUS 2 Query Use Jeewx 2 Query SELECT * FROM Weixin_account 2 Query SHOW STATUS 2 Query SELECT query_id, SUM (DURATION) as sum_duration from INFORMATION_SCHEMA. PROFILING GROUP by query_id 2 Query SELECT state as ' Status ', ROUND (sum (DURATION), 7) as ' DURATION ', CONCAT (ROUND (SUM (DURATION)/0.000659*100,3), '% ') As ' Percentage ' from INFORMATION_SCHEMA. PROFILING WHERE query_id=8 GROUP by state 2 Query SELECT * from ' jeewx '. ' Weixin_account ' LIMIT 0 2 Query SHOW COLUMNS from ' jeewx '. ' Weixin_account ' 150315 12:12:19 2 Query SET profiling=1 2 Query SHOW STATUS 2 Query SHOW STATUS 2 Query Use Jeewx 2 Query SELECT * FROM Weixin_account 2 Query SHOW STATUS 2 Query SELECT query_id, SUM (DURATION) as sum_duration from INFORMATION_SCHEMA. PROFILING GROUP by query_id 2 Query SELECT state as ' Status ', ROUND (sum (DURATION), 7) as ' DURATION ', CONCAT (ROUND (SUM (DURATION)/0.000351*100,3), '% ') As ' Percentage ' from INFORMATION_SCHEMA. PROFILING WHERE query_id=18 GROUP by state 2 Query SELECT * from ' jeewx '. ' Weixin_account ' LIMIT 0 2 Query SHOW COLUMNS from ' jeewx '. ' Weixin_account ' 150315 12:22:39 1 Query ID 150315 12:22:47 1 Query Show Database 150315 12:22:49 1 Query Show databases 150315 12:22:55 1 Query use test 150315 12:23:27 1 Query CREATE TABLE testtable ( ID Integer,
Name varchar (32)) 150315 12:23:31 1 Query Show tables
|
MySQL Open history under windows