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] mysqldump backup and recovery

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

Share

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

Brief introduction:

Mysqldump is commonly used for logical backups of MySQL databases.

Backup operation:

1. Back up all libraries: mysqldump-uroot-pyourpass-- all-databases > / tmp/all.dump2. Back up a single library: mysqldump-uroot-pyourpass test > test.dump3. Backup sheet: mysqldump-uroot-pyourpass test test_tb > test_tb.sql4. Backup stored procedure: mysqldump-uroot-pyourpass-n-d-t-R test > test_procedure.sql

Restore operation:

Make sure that the database to be restored exists before recovery

Restore a single library: mysql-uroot-pyourpass test

< test.dump 或者进入数据库 执行 source test.dump; 从整库备份中恢复单张表:cat test.dump | sed -e'/./{H;$!d;}' -e 'x;/CREATE TABLE `test_tb`/!d;q' >

/ tmp/test_tb.sql-- filter out the table-building statement cat test.dump | grep-- ignore-case 'insert into `test_ tb`' > / tmp/insert_test_tb.sql-- filter the insert statements that insert data

Then execute the corresponding sql in the database as needed to recover the single table.

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

Wechat

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

12
Report