1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Importing .sql files into new MySQL database

Discussion in 'MySQL' started by DarrenC, Nov 4, 2005.

  1. #1
    I want to move a MySQL database tables, data, everything from the old hosting company to the new database on my new hosting company.

    I have the .sql file, i.e. mynamedb.sql

    How do I do this - I'm tearing me hair out!

    Ta

    Darren
     
    DarrenC, Nov 4, 2005 IP
  2. TheHoff

    TheHoff Peon

    Messages:
    1,530
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    0
    #2
    SSH into new server
    put SQL file on new server
    create empty DB on new server

    run from command line:

    mysql -u USERNAME -p DATABASENAME < FILE.SQL
     
    TheHoff, Nov 4, 2005 IP
  3. DarrenC

    DarrenC Peon

    Messages:
    3,386
    Likes Received:
    154
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Okay I know Im been very thick., but I don't have access to the SSH and when you say put SQL file on server, do you mean on my own webspace..

    I have created DB on new server and was going to use the runcommand..
     
    DarrenC, Nov 4, 2005 IP
  4. my3cents

    my3cents Peon

    Messages:
    332
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #4
    my3cents, Nov 4, 2005 IP
  5. TheHoff

    TheHoff Peon

    Messages:
    1,530
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    0
    #5
    If you're paying a company to host the server, maybe their tech support could do it for you? They only have to start the command, not watch it run.. would take them 2 minutes.

    If you don't have access to SSH I'm not sure how you can do it.. assuming it is a fairly large database that you couldn't import with something like PHPMyAdmin (times out after 60 seconds or so). But yea.. you need to get the SQL file on to the new server.. you can FTP it there.. but then you have to issue the mysql commands from the SSH command line... unless it is a fairly small dataset, then you might be able to do it from a web interface.
     
    TheHoff, Nov 4, 2005 IP
  6. DarrenC

    DarrenC Peon

    Messages:
    3,386
    Likes Received:
    154
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Okay guys - thanks. I'll contact the hosting company. I've tried to load the .sql file and it has timed out, it is quite a big forum, so probably why.

    Ta

    Darren
     
    DarrenC, Nov 4, 2005 IP
  7. TheHoff

    TheHoff Peon

    Messages:
    1,530
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Good idea. It isn't tough, but you need that SSH access. Might as well FTP it up there for them to start.
     
    TheHoff, Nov 4, 2005 IP
  8. l234244

    l234244 Peon

    Messages:
    1,225
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Let me know if you have any problems, a programmer I have used in the past has a script that will install the contents of a sql file into a database.
     
    l234244, Nov 4, 2005 IP
  9. GeorgeB.

    GeorgeB. Notable Member

    Messages:
    5,695
    Likes Received:
    288
    Best Answers:
    0
    Trophy Points:
    280
    #9
    without shell level access you're programmer's script will likely fail as well.

    And if the script tries to upload the file and process it as it goes, well... the PHP 2MB timeout will take care of that ;)
     
    GeorgeB., Nov 4, 2005 IP
  10. l234244

    l234244 Peon

    Messages:
    1,225
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I have used the installer.php file on very large databases 200mb+ and it worked no problem :)
     
    l234244, Nov 4, 2005 IP
  11. GeorgeB.

    GeorgeB. Notable Member

    Messages:
    5,695
    Likes Received:
    288
    Best Answers:
    0
    Trophy Points:
    280
    #11
    Like I said, without shell access (which is probably what your script uses to pull this off) it will likely fail.

    The .sql files were on the local server when you ran install.php right?
     
    GeorgeB., Nov 4, 2005 IP
  12. l234244

    l234244 Peon

    Messages:
    1,225
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Installer.php and .sql file on the server, all thats needed was the database connection data (database name, username, password)
     
    l234244, Nov 4, 2005 IP
  13. linkstraffic

    linkstraffic Well-Known Member

    Messages:
    388
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    133
    #13
    how about:

    mysql>source pathtoyourfile.sql

    (sftp ur file first to ur server)
     
    linkstraffic, Nov 7, 2005 IP
  14. PEngdorf

    PEngdorf Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Im doing the same type of converstion from a vendor hosted server to my own and I have to back the database up in a .sql file and have created all my users, but is there something I have to do in order to deploy or unpack the .sql?
     
    PEngdorf, Apr 27, 2008 IP
  15. PEngdorf

    PEngdorf Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    This command helped a lot. This was the last thing that I had to do before getting my LAMP server up and running on CentOS.

    Thanks!
     
    PEngdorf, Apr 27, 2008 IP
  16. webmasterplace

    webmasterplace Peon

    Messages:
    802
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #16
    If you have phpMyadmin, this is very easy.
    Go to your phpMyadmin -> select your database -> go to import -> select your .sql file -> click submit -> done! :)
     
    webmasterplace, Apr 27, 2008 IP
    iBall likes this.
  17. PEngdorf

    PEngdorf Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    I couldnt get phpMyAdmin to work, I did it all through AccuTerm SSH tunnel. :)

    Maybe now that I have the server up and running Ill start on phpMyAdmin to manage any future changes I need.

    Thanks.
     
    PEngdorf, Apr 27, 2008 IP
  18. fxfrog

    fxfrog Peon

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    hi .. thanks to all the tips

    I recently TRIED to move my localhost.sql to my new hosting phpadmin. The problem is the max per upload is 60 MB and my localhost.sql is more than 200 MB. Is there any solutions?
     
    fxfrog, May 28, 2012 IP
  19. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #19
    If the SQL isn't too large use PHPMyAdmin... If it is too large.. zip the SQL then ftp it from one server to the other.. extract.. and import into your mysql... You need SSH and most web hosts will give you access...
     
    NetStar, May 29, 2012 IP
  20. fxfrog

    fxfrog Peon

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #20
    thanks netstar. I uploaded the 1.1 SQL file to hosting provider via FTP. They helped me to export to my SQL database. Now my site is up .. this is article directory bought from flippa http://articlefulltime.com/
     
    fxfrog, Jun 1, 2012 IP