1.全备
mysqldump -u root -padmin --single-transaction --events --triggers --routines --all-databases > all-databases-`date +%F`.sql
2.全备还原
source all-databases-`date +%F`.sql
3.分库备
mysqldump -u root -padmin --single-transaction --events --triggers --routines --databases test > test-database-`date +%F`
4.分库还原
source test-database-`date +%F`.sql
5.分表备
mysqldump -u root -padmin --single-transaction --events --triggers --routines test a > test-a-`date +%F`.sql
6.分表还原
source test-a-`date +%F`.sql
时间: 2024-10-12 20:21:07