Enable log update for MySQL in Linux

Source: Internet
Author: User
Mysql logs include error logs, query logs, slow query logs, update logs and binary logs. View method. In windows, you must

Mysql logs include error logs, query logs, slow query logs, update logs and binary logs. View method. In windows, you must

A bug occurred in the test. I checked the logs printed by the application and found that the data of the previous day was correct, and the data of the next day was incorrect, the only possibility is that someone directly updates the database during this period. Under normal circumstances, each database update requires the program to send some statistics to another department, result an exception occurred when the program sent the data the next day. I suspect that someone directly updates the database using the update statement. This is based on reasoning, but there is not enough evidence, because mysql does not enable the log function. This problem cannot be reproduced. It is very difficult to find a BUG in the application. Add the log update function to mysql! In Baidu, mysql logs are divided into error logs, query logs, slow query logs, update logs and binary logs. In windows, you need to modify the mysql installation directory to my. INI file. in linux, You need to modify etc/my. cnf file, find my. the cnf file is opened in vi. There is a log-update commented in it, add a line below it, configure the path for it, and save it. Then run two commands in the bin directory of the installation directory of mysql to restart mysql. My mysql is installed in the source file, if rpm is used for installation, the restart command is corresponding to Baidu.

# Mysqladmin-u root-p shutdown and enter the mysql password

# Mysqld_safe -- user = root & then run an update statement to check if there are any log files in the path.

The command for viewing log files is

Mysqlbinlog update.000001

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.