MySQL Event Tracker, MySQL does not need to restart the service tracking SQL, or configure the log

Source: Internet
Author: User

The first step is to create the following two log tables

Press CTRL + C to copy the code<textarea></textarea>Press CTRL + C to copy the code
  CREATE TABLE ' General_log ' (   ' event_time ' timestamp not NULL DEFAULT current_timestamp on                          UPDATE Current_ TIMESTAMP,   ' user_host ' mediumtext not NULL,   ' thread_id ' bigint (+) unsigned not null,   ' server_id ' int (10) unsigned not NULL,   ' command_type ' varchar ($) NOT null,   ' argument ' mediumtext not null  ) Engine=csv DEFAULT Charset=utf8 comment= ' General log '

The second step is to open the query log on the database

SET Global general_log = 1; SET Global log_output = ' table ';

Step three query log

SELECT * FROM Mysql.general_log


Step fourth closes the query log on the database

SET global general_log = 0;

Fifth step clear the database log

TRUNCATE TABLE Mysql.general_log;

http://blog.csdn.net/testcs_dn/article/details/18791815

MySQL Event Tracker, MySQL does not need to restart the service tracking SQL, or configure the log

Related Article

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.