PDA

View Full Version : restoring database command



boogyman
06-26-2007, 09:45 PM
just for researching purposes, how would I go about restoring a database file contained within a .bz2 archive on a linux server? and also do I need to be in a specific folder when I do restore the dumped database?

I looked online but for some reason I am not entering the correct search terms or something.

Thanks
Boogyman

Twey
06-26-2007, 11:03 PM
It depends how it was made. The most common setup is a MySQL database backup made with mysqldump. mysqldump simply writes the commands to create the database to a file; the file is then compressed to save space using bzip2. To restore it, decompress it and execute the commands against the database (sample uses bash):
$ (echo 'your_password'; echo 'use your_database_name'; bzcat your_backup_file.sql.bz2) | mysql -u your_user -p