Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL data recovery full backup recovery and incremental recovery (take manual deletion database as an example)

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Data recovery schematic diagram

Test environment MySQL5.5

1 first create a new database lampol data table test

Create database lampol

Use lampol

Create table test (id int (10), name varchar (10))

2 insert data information

Insert into test values (1)

Insert into test values (2) lampol2'

3 Information after insertion

Mysql > select * from lampol.test

+-+ +

| | id | name |

+-+ +

| | 1 | lampol1 |

| | 2 | lampol2 |

+-+ +

4 start to simulate the full backup in the early morning

Mysqldump-uroot-proot-flush-logs-single-transaction-master-data=2 lampol > / shell/test.sql

(1)-- flush-logs refreshes the cutting log to facilitate the recovery of incremental binlog later

(2)-- single-transaction InnoDB storage engine MyISAM-- lock-all-tables (lock table)

(3)-- master-data=2 records the location of the backup, binlog log and pos

Full backup successfully records msyql-bin log and location

5. Start inserting data after backup. These data are not included in the complete set.

Insert into test values (3 minutes lampol3')

Insert into test values (4 million lampol4')

6 execute drop database lampol

After the database is deleted

Start recovery

1 stop external access first; stop the web server and begin to prepare for recovery

Flush logs refreshes the binlog log, otherwise the full amount imported later may be written into binlog to affect the recovery

2 start to restore full backup to create deleted database

Mysql-uroot-proot lampol / shell/bin.sql

Go to bin.sql and find drop database lampol;. Delete this sentence.

Import bin.sql into the database

Mysql-uroot-proot lampol

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report