Two ways: MySQL view the SQL statement being executed

Source: Internet
Author: User

MySQL view the SQL statement being executedAugust 21, 2015 17:32:59 read: 15398

There are 2 ways of doing this:

1, the use of processlist, but there is a disadvantage, is only to view the SQL statements being executed, corresponding to the history, not see. The benefits are not set, and will not be saved.

-- use information_schema;-- show processlist;或者:-- select * from information_schema.`PROCESSLIST` where info is not null;
    • 1
    • 2
    • 3
    • 4

2. Turn on log mode

-- 1, settings--SET global log_output =  ' TABLE '; set global general_log =  ' on ';-- Span class= "Hljs-keyword" >set global log_output =  ' TABLE '; Span class= "Hljs-keyword" >set global general_log =  ' OFF ';-- Span class= "Hljs-number" > 2, query select * from Mysql.general_log order by event_time DESC--      
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

Two ways: MySQL view the SQL statement being executed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.