The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

General walkthrough on how to copy databases

Discussion in 'General Discussion' started by aykfounder, Oct 26, 2005.

  1. aykfounder

    aykfounder Well-Known Member

    Feb 22, 2004
    Likes Received:
    Trophy Points:
    The following way is only good for users with phpMyAdmin installed on their servers!

    1. Login to your old control panel and go to PHPmyAdmin (if you are running Cpanel, it will be under MySQL, at the bottom).
    2. Choose the database you want to move from the drop down list on the left.
    3. After the page loads, click on the 'Export' tag at the top of the right page. Then 'Select All'. This will select all the tables in the database.
    4. Finally, check the SQL extension type (should be default), check the Save To File box and put in the name you want this file to have.
    5. Hit 'Go'. This will save the .sql file to your machine at home/office.
    6. Upload the .sql file to that account on your new server.
    7. Login to shell and put in:
    'mysql -u dbname_user -p dbname_dbname < dbfile.sql
    8. Hit enter and for the password put in the password of that database.

    If you do not have shell access, you can use phpmyadmin to do the same, almost.

    After downloading the file, login to your phpmyadmin panel on your new server, choose the database you want to populate (must have the same name as the one on your old server), click on the SQL tab and copy/paste the whole database into the text field. Then just hit 'Go'. If the database is large, it may take a while, so give it some time.

    Also, make sure that the version of MySQL is the same on both servers!!! (ie 4.0.x will not work with 4.1.x)

    If I got something wrong, please update it. I've been working on copying some dbs over and that last part (the sql version) really got me for a bit, as nothing has worked. I finally figured it out by looking on these forums. Hope this helps. :cool:
  2. domtaj

    domtaj Active Member

    Aug 29, 2005
    Likes Received:
    Trophy Points:
    For what it's worth, we have had not much problem exporting and reimporting back specific tables from mysql 3.x to mysql 4.1.x, at least for postnuke and oscommerce sites. On sites which it didn't import cleanly, we had to export using the "Complete inserts" option for Data to get it through.

Share This Page