How can I restore a backup of a MySQL database?
Q. I made MySQL backup using mysqldump -u user -h localhost -ppassword forumdb | -gzip -9 > forumdb.sql.gz command. How do I restore MySQL database backup using a shell prompt under Linux / UNIX operating system?
A. mysqldump command is text-based client or tool for dumping or backing up mysql databases, tables and or data. You can use same command as follows:
$ gunzip forumdb.gz
Now, restore using mysqldump:
$ mysqldump -u user -h localhost -ppassword forumdb < forumdb.sql
Alternatively, use mysql command as follows:
$ mysql -u user -h localhost -ppassword forumdb < forumdb.sql
See also:
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- Restore a backup of a MySQL Database Server
- RPM database location for backup purpose
- Import MySQL dumpfile, SQL datafile into my database
- Ubuntu Linux Backup MySQL server Shell Script
- MySQL empty database / delete all tables
Discussion on This FAQ
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: backup script, database backup, Linux, localhost, mysql command, mysql databases, mysqldump command, restore mysql, UNIX, unix operating system



October 11th, 2006 at 3:08 am
This FAQ kust rocks. Great tips.
Cheers,.
-Kenan