Mysql backup and restore
Examples of backing up and restoring a mysql database using the command line on bolt.sonic.net
Backing up mysql using the command line:
Running the below command will prompt you for your mysql password. Once entered it will export your entire database into the file backup.sql. This file can then be used to restore your database at a later date if you need to.
mysqldump --skip-lock-tables -u YOUR_DATABASE_USERNAME -h YOUR_DATABASE_HOSTNAME -p YOUR_DATABASE_NAME > backup.sql
Restoring a mysql backup using the command line:
Running the below command will restore your mysql backup using the data in backup.sql. This will overwrite any existing duplicate tables that may be in the database already. Caution should be taken when running this command so you do not lose any valuable data.
mysql -u YOUR_DATABASE_USERNAME -h YOUR_DATABASE_HOSTNAME -p YOUR_DATABASE_NAME < backup.sql