Page 1 of 1

a stupid question about backup and recover mysql database

Posted: Sun Jul 24, 2005 7:24 am
by php12342005
I test to backup my database - download to my PC as a file (host does this), i.e. main.gz.

questions:
1. what does a gz file mean? is it just a compressed file? is it readable (undestood) by us? can I view TABLEs, FIELDs and data from the gz file?
2. how to recover my database from the main.gz file?

I am new to mysql database.

thanks

Posted: Sun Jul 24, 2005 1:50 pm
by Burrito
.gz files are a compressed file, like a .zip or a .tar. You will need to "ungz" the file before you can view it. Once you do, you'll have a dump of your database (a .sql file) which you can then import into MySQL to "recover" your data.

Posted: Mon Jul 25, 2005 10:01 am
by pickle
Usually, databases are backed up using the mysqldump program. That program will give you a raw .sql file. Someone has to then compress the file into a .gz, so that the file is smaller. If you're running on linux, the command to unzip that will be:

Code: Select all

gunzip myFile.gz
You will then likely be given that .sql file. To import it back into mysql, call:

Code: Select all

mysql -u root -p rootPass databaseName < myUncompressedFile.sql