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
a stupid question about backup and recover mysql database
Moderator: General Moderators
-
php12342005
- Forum Commoner
- Posts: 79
- Joined: Mon Mar 21, 2005 3:35 am
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:
You will then likely be given that .sql file. To import it back into mysql, call:
Code: Select all
gunzip myFile.gzCode: Select all
mysql -u root -p rootPass databaseName < myUncompressedFile.sqlReal programmers don't comment their code. If it was hard to write, it should be hard to understand.