How to Backup and Restore MySQL Database in Linux/Redhat/CentOS
This tutorial shows how to take backup and how to restore the MySQL database. Backuping the database is very important for the system administrator.
This backups can be automated using the cron job. Here i am using the manual utility “mysqldump” for taking the backup and restoring the database.
Backup MySQL Database:
mysqldump -h [hostname] -u [username] -p[password] [database] > [backup_file]
There should not be any space between -p and password.
mysqldump -h localhost -u root [email protected]@$52 dbase01 > dbase01.sql
Once backup done, If required you can restore by using the following command.
Restore MySQL Database:
mysql -h [hostname] -u [username] -p[password] [database] < [backup_file]
mysql -h localhost -u root [email protected]@$52 dbase01 < dbase01.sql
That’s All. You can also use the phpMyAdmin to backup and restore databases.