Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How to copy an existing db on same server

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

  1. rwoody

    rwoody Member

    Jul 26, 2003
    Likes Received:
    Trophy Points:
    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

    Jun 10, 2004
    Likes Received:
    Trophy Points:
    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

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice