Importing using mysqldump

Discussion in 'MySQL' started by kool002, May 13, 2007.

  1. #1
    Hi,
    Can someone tell me how to import the data from a .sql file using mysqlsumb on a live website.

    I mean I have used it when data was on my local machine but how to do when website is live and database is stored remotely i-e when website is hosted.
     
    kool002, May 13, 2007 IP
  2. Clark Kent

    Clark Kent Guest

    Messages:
    122
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Install phymyAdmin.
    Go to Import.
    Select your sql file on your local machine and upload/execute file.

    Most hosting companies preinstalls phpmyadmin, you may also have it.

    I also suggest mysqldumper (mysqldumper.de/en). It is very easy to install and backup & restore operations are fast.
     
    Clark Kent, May 13, 2007 IP
  3. kool002

    kool002 Peon

    Messages:
    342
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi,
    I should have mentions I have phpmyadmin and it fails to import as the .sql file is big.
     
    kool002, May 13, 2007 IP
  4. alamster

    alamster Peon

    Messages:
    41
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    upload your sql file to public html and ask for hosting support guy to restore it for you
     
    alamster, May 13, 2007 IP
  5. eddy2099

    eddy2099 Peon

    Messages:
    8,028
    Likes Received:
    568
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The SQL File is just a text file. You can always break them up into several parts. Of course, uploading it and let your web host restore it is a very good idea.
     
    eddy2099, May 13, 2007 IP
  6. dcristo

    dcristo Illustrious Member

    Messages:
    19,776
    Likes Received:
    1,200
    Best Answers:
    7
    Trophy Points:
    470
    Articles:
    7
    #6
    Yeah as already suggested, break the SQL file into smaller chunks and import, or get your host to sort it out.
     
    dcristo, May 14, 2007 IP
  7. CodyRo

    CodyRo Peon

    Messages:
    365
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #7
    If you have shell access I usually use the following:

    
    mysql -u user -p -D database < backup.sql
    
    Code (markup):
     
    CodyRo, May 14, 2007 IP
  8. alamster

    alamster Peon

    Messages:
    41
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    mysql -uuser, no space
     
    alamster, May 14, 2007 IP
  9. CodyRo

    CodyRo Peon

    Messages:
    365
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Space is fine, no space if you specify password (EX: mysql -u root -ppassword)

    :rolleyes:
     
    CodyRo, May 14, 2007 IP
  10. Folagi

    Folagi Well-Known Member

    Messages:
    58
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    100
    #10
    If it is too big you can add it to a .zip file to reduce size and import it or .tar.gz.
     
    Folagi, May 14, 2007 IP
  11. Clark Kent

    Clark Kent Guest

    Messages:
    122
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #11
    @kool002: You can try my second suggestion mysqldumper. It backup and restores sql files with little chunks so It never timeouts. I am using it with millions of records and I never had a problem.
     
    Clark Kent, May 14, 2007 IP