Log MySQL-executed SQL

Source: Internet
Author: User

Compare Oracle features to learn MySQL always find highlights

The ability to log mining in Oracle allows you to find all the records that have been executed;

MySQL also provides 3 methods {validated, I will record specific practices}

Method 1:{Verified}

Record all of MySQL's records
Open/ETC/MY.CNF
Add below [mysqld]
Log =/mnt/mydata/sql.log

Restart MySQL
View/mnt/mydata/sql.log File

Method 2:{temporarily not verified}

Check the SQL syntax for slow query:
Log_slow_queries =/var/log/mysql/mysql-slow.log
Long_query_time = 2 (more than 2 seconds of SQL syntax is recorded, it is also a way to set a short point to record the error.)

Method 3:{temporarily not verified}

Set MySQL replication with Binlog:

Log_bin =/var/log/mysql/mysql-bin.log (this file is to be seen with the Mysqlbinlog solution,
Mysqlbinlog mysql-bin.000042| grep "T_ABC" | grep "Column Value"
MySQL will write all the insert/update/delete syntax in this (but the syntax may be different from what you think), which is the log file to write to slave

Log MySQL-executed SQL

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.