How to copy an existing db on same server

rwoody

Member
Jul 26, 2003
24
0
151
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.:)
 

S-Combs

Well-Known Member
Jun 10, 2004
78
0
156
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