Windows下MySQL開啟記錄

來源:互聯網
上載者:User

標籤:

開啟my.ini檔案,位置安裝目錄下,添加開啟日誌的配置,重啟mysql

# SERVER SECTION# ----------------------------------------------------------------------## The following options will 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 Loglong_query_time = 1slow_query_log = 1slow_query_log_file = "slowquery.log"#Set General Loglog = "genquery.log"

 

slow_query_log_file、log 的檔案位置可以自己制定絕對路徑,預設在資料檔案夾下。

long_query_time單位為秒,即大於1秒的查詢語句將記錄在slowquery.log檔案中。

log 是執行的SQL語句都將記錄下來。

如下:

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

 

 

Windows下MySQL開啟記錄

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.