"MySQL" Mysqlbinlog related introduction

Source: Internet
Author: User
Tags base64 mysql functions mysql version

Binlog Introduction:
A binary log that records SQL statements that occur to or potentially change data, and is stored in a binary form on disk.
function:
MySQL functions like Oracle's archive logs, which can be used to view the history of a database's changes (all SQL operations at a specific point in time), incremental database backups and restores (incremental and point-in-time recovery), and MySQL replication.
Open:
Show variables like '%log_bin% '; To see if opening
Method One, modify the my.cnf parameter file, the method needs to restart
Log-bin=mysql-bin #打开日志 (host needs to open), this mysql-bin can also be customized, here can also add a path, such as:/home/www/mysql_bin_log/mysql-bin
method to turn off binary logging: Log-bin = mysql-bin comment out
Method Two, do not restart the modified binary log configuration, the method MySQL version needs more than 5.6
SET @ @global. log_bin=1|0?? (1 is on, 0 is off)
View:

# 可查看参数帮助mysqlbinlog??--no-defaults --help # 查看最后100行mysqlbinlog??--no-defaults --base64-output=decode-rows -vv mysql-bin.000001 |tail -100 # 根据position查找mysqlbinlog??--no-defaults --base64-output=decode-rows -vv mysql-bin.000001 |grep -A 20 ‘4939002‘ # 根据position恢复部分数据 也可根据时间点恢复mysqlbinlog??--no-defaults --start-position=204136360 --stop-position=204136499 mysql-bin.000006 | mysql -uroot -pyourpassword test

"MySQL" Mysqlbinlog related introduction

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.