mysql-Log Management

Source: Internet
Author: User
Tags benchmark

MySQL Log management
/etc/my.cnf

Error log wrong/var/log/mysqld.log "default on"
Bin log binary log backup incremental backup DDL DML DCL
Relay Log relay Log replication receives replication Master
Slow log slow query log tuning query time exceeds specified value

Error Log
Log-error=/var/log/mysqld.log

Binary Log
Log-bin=/var/log/mysql-bin/slave2
server-id=2

Mkdir/var/lib/mysql-bin
#chown mysql.mysql/var/lib/mysql-bin/
#systemctl Restart Mysqld

Note:

    1. Restarting MYSQLD will truncate
    2. Flush logs will truncate
    3. Reset Master Removes all Binlog RM-RF/
    4. Delete part
      PURGE BINARY LOGS to ' mysql-bin.010 ';
      PURGE BINARY LOGS before ' 2016-04-02 22:46:26 ';

    5. Pause only Current session
      SET sql_log_bin=0;
      SET sql_log_bin=1;

    6. Intercept Binlog
      All
      Mysqlbinlog mysql.000002

Datetime:
#mysqlbinlog mysql.000002--start-datetime= "2018-12-05 10:02:56"
#mysqlbinlog mysql.000002--stop-datetime= "2018-12-05 11:02:54"
#mysqlbinlog mysql.000002--start-datetime= "2018-12-05 10:02:56"--stop-datetime= "2018-12-05 11:02:54"

Position
#mysqlbinlog mysql.000002--start-position=260
Mysqlbinlog mysql.000002--stop-position=260
#mysqlbinlog mysql.000002--start-position=260--stop-position=930

Slow Query Log
Slow_query_log=1
Slow_query_log_file=/var/log/mysql-slow/slow.log
Long_query_time=3

#mkdir/var/log/mysql-slow/
#chown mysql.mysql/var/log/mysql-slow/
#systemctl Restart Mysqld

View Slow query log
Test: BENCHMARK (count,expr)
SELECT BENCHMARK (50000000,2*3);

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.