Mysql backup and restore

By | 2018 年 4 月 20 日

Backup

This is for selected database(s) backup:

mysqldump database_name > database_backup.sql

Or:

mysqldump --databases database_one database_two > databases_backup.sql

This is for whole db backup:

mysqldump --all-databases > all_databases.sql

Restore

Note: you may need -uroot or proper user to do the following operations.

For selected database:

mysql database_name < database_backup.sql

Or

mysql --one-database database_one < databases_backup.sql

For whole database:

mysql < databases_backup.sql

发表评论

电子邮件地址不会被公开。 必填项已用*标注