Backup and binary log recovery for MySQL database

Source: Internet
Author: User

  1. MySQL Backup and Bin-log logs

    Backup data: Mysqldimp-uroot-p test-l-F '/tmp/test.sql '

    -L Read lock

    -F that is flush logs, you can regenerate the log files, including, of course, log-bin logs.


    View Bin-log logs with mysql>show master status;

    Clear table data truncate tables;

  2. Log recovery based on binary Bin-log

    View Bin-log Logs

    Mysqlbinlog--no-defaults mysql-bin.000002 | More to find the corresponding event according to the end_log_pos= location

    Recovery format: Mysqlbinlog--no-defaults mysql-bin.000002 |mysql-uroot-p test

  3. Recovery of MySQL Database

    Recovery data: Mysql-uroot-p test-v-F </tmp/test.sql

    -V View Import details

    -F is when an error is encountered in the middle, you can skip the past, continue to execute the following statement

  4. Restore based on End_log_pos node value

    Mysqlbinlog--no-defaults--stop-posistion= "555" mysql-bin.000002|mysql-uroot-p test

  5. Mysqldump+binlog to restore the complete process

    Mysqlbinlog the following main parameters:

    --stop-posistion= "100"

    --start-position= "50"

    --stop-date= "2012-10-10 21:12:12"

    --start-date= "2012-10-10 21:12:12"


Backup and binary log recovery for MySQL database

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.