MySQL Log management

Source: Internet
Author: User

Error log

Log_error

Log_warning

General Query Log

General_log

General_log_file

Log

Log_output

Slow query log

Long_query_time

Log_slow_queries={yes|no}

Slow_query_log |off

Slow_query_log_file |/mydata/data/localhost-slow.log

Set global slow_query_log=1;

Binary logs: Operations that can cause changes to the database are recorded

Replication, point-in-time recovery:

Mysqlbinlog Viewing binary log commands

--start-datetime Specify start time and end event to view

--stop-datetime

--start-position the specified position for display

--stop-position

#mysqlbinlog--start-datetime= ' 2016-09-10 15:10:10 ' mysql-bin.00005

#mysqlbinlog--start-position=107

#mysqlbinlog mysql-bin.00005

Format of binary Log

Statement-based statement

Based on Row row

Mixed Mode Mixed


mysql> flush logs; manual scrolling log

Mysql> purge binary logs to ' mysql-bin.00003 '; Manually delete all files before specifying a binary file

Mysql> show binary logs; View binary files that are currently owned


Cd/mydata/data

Cat Mysql-bin.index View all binary files

Mysql> Show Master Status View binary files currently in use

Mysql> show Binlog events in ' mysql-bin.0005 '; View the information recorded in a binary file

Mysql> show Binlog events in ' mysql-bin.0005 ' from 107; indicate from which location to start the display

Replay

Relay Log

Transaction log ACID, which converts random io to sequential io;


Show global variables '%log% '; Display information related to log

Show global variables '%long% '; Displays the length of the defined time, or slow query if it exceeds this length




This article from "Operation and maintenance Growth Road" blog, declined reprint!

MySQL Log management

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.