MYSQL Backup & Restore

By | Command Line, MySQL

Sometimes I need to backup and restore my MySQL databases, I don’t do it often enough to commit it to memory so here are the steps

NOTE: Below is considered bad practice because the password is in clear text but it serves my purposes in scripts πŸ˜‰

MYSQL BACKUP COMMAND

mysqldump --user='root' --password='PASS' DATABASE > BACKUP_FILE.sql 

MYSQL RESTORE COMMAND

mysql --user='root' --password='PASS' DATABASE < BACKUP_FILE.sql 

Leave a Reply

Your email address will not be published. Required fields are marked *