How to Backup and Restore MySQL Database in Linux/Redhat/CentOS

ADVERTISEMENT

This tutorial shows how to take backup and how to restore the MySQL database. Backuping the database is very important for the system administrator.

 

ADVERTISEMENT
Article will continue after the ad

 

 

 

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:

Syntax:

mysqldump -h [hostname] -u [username] -p[password] [database] > [backup_file]

There should not be any space between -p and password.

Example:

mysqldump -h localhost -u root -pP@ssw0rd@$52 dbase01 > dbase01.sql

Once backup done, If required you can restore by using the following command.

Restore MySQL Database:

Syntax:

mysql -h [hostname] -u [username] -p[password] [database] < [backup_file]

Example:

mysql -h localhost -u root -pP@ssw0rd@$52 dbase01 < dbase01.sql

 

That’s All. You can also use the phpMyAdmin to  backup and restore databases.

ADVERTISEMENT

POSTS YOU MAY LIKE -:)

Share This Post

  • Panna

    mysqldump -h localhost -u root -pP@ssw0rd@$52 dbase01 < dbase01.sql

    mysqldump not use for undump.

Shares