Sunday, June 10, 2012

Backups & Restore of MySQL Databases Using mysqldump

If you work with MySQL at any level you may need to backup your databases & restore.MySQL is most popular open source RDBMS widely use.MySQL that has always disappointed me  because of there are so many free tools for backing up databases confused when selecting the exact tool.Backups are extremely easy in MySQL to create with mysqldump."mysqldump" is the only backup tool that most MySQL users know and use, and it’s available whatever MySQL.

Database Backup

Backup a single database
 you can also use the shortcuts -u and -p to specify username and password
mysqldump --user=... --password=...   your_database_name >  your_database_name.sql

Backup multiple databases
mysqldump --user=... --password=... --databases db1 db2 > backup.sql

All the databases
mysqldump --user=... --password=... --all-databases > backup.sql

Restoring DB Backup

Created the destination database & then created the users & give appropriate privileges.Restoring is usually done this way:

mysql –u root –p[password] restoredbname < dbname_backup.sql

No comments:

Post a Comment