Restoring MySQL Databases

Discussion in 'Site & Server Administration' started by kc3, Mar 13, 2005.

  1. #1
    In phpMyAdmin I tried to restore a MySQL database that was pretty large, problem was is that it timed out because it took so long to upload. So I was wondering if there was some way I could restore it through another website as in telling it to restore the database to a backup held on a website. If not are there any other suggestions you could make?
     
    kc3, Mar 13, 2005 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    Do you have administrator access to the MySQL server?

    What format do you have the database you are trying to restore? Is it a SQL dump?
     
    digitalpoint, Mar 13, 2005 IP
  3. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #3
    If you have shell access upload the backup file to your server. Then login to SHH and try the following command in the same folder as your uploaded backup file. This assumes the dump was done with mysqldump or equivelent and the file is not gzip'd and an empty mysql DB exists to put the data into. If it's gzip'd use gzip -d to decompress it first.

    mysql -u DB_USER_NAME -p DB_NAME < BACKUP_FILE_NAME.sql

    You will be prompted for a password.

    If you do not have shell access use a cron job. all the assumptions are the same as above and the backup file is assumed to be decompressed.

    mysql -u DB_USER_NAME -pDB_PASSWORD DB_NAME < /home/ACCOUNT_NAME/BACKUP_FILE_NAME.sql

    Add the cron job in cpanel to run in like one minute from the current time. After it runs, delete the cron job.
     
    noppid, Mar 13, 2005 IP