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.

How to copy an existing db on same server

Discussion in 'General Discussion' started by rwoody, Jan 6, 2007.

  1. rwoody

    rwoody Member

    Joined:
    Jul 26, 2003
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    I am currently in the process of doing upgrades on multiple site applications. I would like to make a copy of the current dbs with a new name on the same server so as not to disturb the production site until the upgrade proves stable. What is the easiest way to do this?

    These are large dbs, so uploading a backup to a newly created db is really a pain as I must split the dbs to avoid time outs. I was hoping there might be a way after creating the new db to do a direct copy of the structure and data to the newly created db.

    Thanks for any suggestions.:)
     
  2. S-Combs

    S-Combs Well-Known Member

    Joined:
    Jun 10, 2004
    Messages:
    78
    Likes Received:
    0
    Trophy Points:
    6
    You can do that in WHM/PHPmyAdmin

    Select the database you want to copy then click the Operations tab / Copy database to:

    After this assign a user to the new database.


    Or in SSH you can do this (Are probably simpler ways but this will work)

    cd /var/lib/mysql

    cp -RP Database1 Database2

    chown -R mysql /var/lib/mysql/Database2
    chgrp -R mysql /var/lib/mysql/Database2

    login to phpmyadmin

    Assign a user to Database2
     
Loading...

Share This Page