用户工具

站点工具


zh:notes:mysql_backup_restore

Backup and Restore MySQL Database

Backup One Database

> mysqldump -uusername -ppassword databasename > database-backup.sql

Backup Multiple Tables in a Database

> mysqldump -uusername -ppassword databasename specific_table1 specific_table2 > database-backup.sql

Backup Multiple Databases

> mysqldump -uusername -ppassword –databases databasename1 databasename2 databasename3 > database-backup.sql

Backup the Structure of a Database

> mysqldump --no-data -uusername -ppassword databasename > database-structure.sql

Backup the Structures of Multiple Databases

> mysqldump --no-data -uusername -ppassword –-databases databasename1 databasename2 databasename3 > database-structure.sql

Backup All Databases

> mysqldump –all-databases > database-backup.sql

Restore a Database

>mysql -uusername -ppassword databasename < database-backup.sql
zh/notes/mysql_backup_restore.txt · 最后更改: 2022/10/20 17:20 由 pzczxs