How can I restore a backup of a MySQL database?

by Vivek Gite on July 29, 2006 · 1 comment

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:

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 1 comment… read it below or add one }

1 Kenan Bektas October 11, 2006

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> <blockquote> <pre> <a href="" title="">
What is 11 + 3 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: