Differences
This shows you the differences between two versions of the page.
linux_wiki:backup_and_restore_a_database [2018/04/20 12:25] billdozor [Lab Setup] |
linux_wiki:backup_and_restore_a_database [2019/05/25 23:50] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Backup And Restore A Database ====== | ||
- | |||
- | **General Information** | ||
- | |||
- | Backing up and restoring a database. | ||
- | |||
- | ---- | ||
- | |||
- | ====== Lab Setup ====== | ||
- | |||
- | The following virtual machines will be used: | ||
- | * server2.example.com (192.168.1.151) -> Database installed here | ||
- | |||
- | **Previous Section Completed** | ||
- | * [[linux_wiki: | ||
- | |||
- | ---- | ||
- | |||
- | ====== Backup ====== | ||
- | |||
- | Backup 1 specific database: Run the MySQL Dump utility to backup tables within a database | ||
- | <code bash> | ||
- | mysqldump -u root -p emails > / | ||
- | </ | ||
- | * Builds SQL commands that will create the tables from scratch | ||
- | |||
- | \\ | ||
- | Backup multiple databases | ||
- | <code bash> | ||
- | mysqldump -u root -p --databases emails mysql > / | ||
- | </ | ||
- | * --databases -> flag to backup multiple databases at once | ||
- | |||
- | \\ | ||
- | Backup all databases | ||
- | <code bash> | ||
- | mysqldump -u root -p --all-databases > / | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ====== Restore ====== | ||
- | |||
- | Restore 1 specific database' | ||
- | <code bash> | ||
- | mysql -u root -p | ||
- | MariaDB [(none)]> | ||
- | MariaDB [(none)]> | ||
- | mysql -u root -p emails < / | ||
- | </ | ||
- | |||
- | ---- | ||