MySQL log viewing and opening

Source: Internet
Author: User

Log type for MySQL:

Error log: Log-error
Query log: Log
Slow query log: log-slow-queries
Update log: Log-update
Binary log: Log-bin

Turn on the error log

log-error=/usr/local/mysql/log/log-error. Log

Start query Log

log=/usr/local/mysql/log/log-query. Log

Turn on slow query log

log-slow-queries=/usr/local/mysql/log/log-slow-query. Log

Turn on the update log

log-update=/usr/local/mysql/log/log-update. Log

Open Binary Log

log-bin=/usr/local/mysql/log/log-bin. Log

Instance test: Turn on query log, error log

1, edit the/ETC/MY.CNF, that is, edit the MySQL configuration file

Vi/etc/my.cnf

2. Add code snippet to open query log and error log

    

3. Restart MySQL Database

4, enter the command, real-time view Log-query.log file

Tail-f/usr/local/mysql/log/log-query. Log

5. Open another terminal and go to MySQL for query operation.

1     MySQL -uroot-p12345623 use test45 SELECT * from one;          

6, the implementation of step 5 o'clock, the contents of Log-query.log will be changed

Issue: In the/usr/local/mysql/log/folder, there are log-error.log files, but there are no log-query.log files.

Cause: In the Log-error.log file, find the error prompt. I understand that there is no permission to create a file. However, how to have permission to create log-error.log files, really tangled.

FIX: Create a Log-query.log file yourself and set the permissions to 777 (a bit violent)

MySQL log viewing and opening

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.