Results 1 to 2 of 2

Thread: restoring database command

  1. #1
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default restoring database command

    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

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    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):
    Code:
    $ (echo 'your_password'; echo 'use your_database_name'; bzcat your_backup_file.sql.bz2) | mysql -u your_user -p
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •