#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    6
    Rep Power
    0

    Extract MySQL information from a compressed tar.gz file


    I have a back up-of a MySQL database which is contained in a .tar.gz file - I need to restore it.

    I've never had to do this before. The only way I can access the database is through phpmyadmin. There is an 'import' feature in phpmyadmin, but this doesn't accept files in the tar.gz format, only sql.

    Is there any way I can convert from .tar.gz to sql? I know I can upload from an sql file without a problem.

    I don't have access to any 'back-end' stuff on the web-server, so I'm limited with what I can do locally on my PC.

    Any help is much appreciated.
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,922
    Rep Power
    1045
    Um, how about extracting the sql file from the archive?

    A ".tar.gz" is a compressed archive -- just like a ".zip", ".rar" or whatever you're familiar with. To get the original content, you extract it from the archive.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    6
    Rep Power
    0
    Thanks for reply Jacques1. I have managed to extract the from the gz file to a tar file, but still have the same problem - how do i get this tar file converted to an sql file.
  6. #4
  7. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,301
    Rep Power
    7170
    A tar file is also an archive, just not a compressed one. You just extra the SQL file from it.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    6
    Rep Power
    0
    Originally Posted by E-Oreo
    A tar file is also an archive, just not a compressed one. You just extra the SQL file from it.
    I've tried extracting it through two stages:

    1) FILENAME.tar.gz > extracts to one file: FILENAME.tar

    2) FILENAME.tar > extracts to 3 sub folders: "PaxHeader", "mysql" and "HPM" (the database name)

    The "HPM" folders contain various files name after the table names with extensions like ".MYD" and ".FRM" and ".MYI"

    I was hoping for 1 sql file.
  10. #6
  11. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,922
    Rep Power
    1045
    The files you got there are the raw data, the format information and the index data (look it up on Google). You need to copy them into the "data" subdirectory of MySQL.

    This is not an SQL dump. It's a copy of the data files.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    6
    Rep Power
    0
    Originally Posted by Jacques1
    The files you got there are the raw data, the format information and the index data (look it up on Google). You need to copy them into the "data" subdirectory of MySQL.

    This is not an SQL dump. It's a copy of the data files.
    Can i do this using php commands? I don't have direct access to MySQL.
  14. #8
  15. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,922
    Rep Power
    1045
    I'm talking about copying files. Whoever manages your server needs to take your files and copy them into the "data" directory of the MySQL installation.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    6
    Rep Power
    0
    Originally Posted by Jacques1
    I'm talking about copying files. Whoever manages your server needs to take your files and copy them into the "data" directory of the MySQL installation.
    Ok thanks, I understand. The host is Yahoo, so I don't think they'll do it. I could try another hosting company, but how would I know if I could access the MySQL data directory?

    Thanks for the help by the way, everything is a lot clearer now.
  18. #10
  19. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,922
    Rep Power
    1045
    Well, you could also import the files to a database on your PC and export them again in whatever format you need.

    Kinda silly, but I guess that's the only way to deal with the limited access rights.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  20. #11
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    6
    Rep Power
    0
    Originally Posted by Jacques1
    Well, you could also import the files to a database on your PC and export them again in whatever format you need.

    Kinda silly, but I guess that's the only way to deal with the limited access rights.
    I'm just installing MySQL on my PC as we speak!

IMN logo majestic logo threadwatch logo seochat tools logo