How can I restore a backup of a MySQL database?

by on July 29, 2006 · 1 comment· last updated at May 3, 2008

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:



You should follow me on twitter here or grab rss feed to keep track of new changes.

Featured Articles:

{ 1 comment… read it below or add one }

1 Kenan Bektas October 11, 2006 at 3:08 am

This FAQ kust rocks. Great tips.

Cheers,.

-Kenan

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <kbd> <blockquote> <pre> <a href="" title="">

Tagged as: , , , , , , , , ,

Previous Faq:

Next Faq: