Copying
- In cPanel, select "phpMyAdmin"
- In phpMyAdmin, select the database you intend to copy.
- Click the "Operations" tab.
- Find and select "Copy database to".
- Enter the name of the new database (the copy).
- Select "structure and data" - this will copy everything in the database. If you do not want the data, select "structure only".
- Put a checkmark in the box marked "CREATE DATABASE before copying".
- Put a checkmark in the box marked "Add AUTO_INCREMENT value".
- Click "Go".
Â
Renaming
- In cPanel, select "MySQL Databases".
- Find the database you wish to rename in the list of Current Databases.
- Take note of the user already assigned to the database.
- Open phpMyAdmin.
- Select the database you wish to rename.
- Select the "Operations" tab.Â
- Enter the new database name in the field titled "Rename database to".
- Click "Go".
- When phpMyAdmin confirms, verify the name is spelled correctly and click "OK".
- When prompted to reload the database, click "OK".
Now you need to reconfigure the user permissions for the database.
- Go back to "MySQL Databases".
- Find the database from the list under "Add User To Database"
- Choose the user from the list.
- Select "Add".
- Put a checkmark in the "All Privileges" box.
- Click "Make Changes"
Now you must update all scripts or applications which reference the database with the correct name.
Merging
Both databases that you intend to merge must be on the same account.
In cPanel
- Click phpMyAdmin.
- Click "SQL" at the top.
- Underneath "Run SQL query/queries on server "localhost"", insert this code: "INSERT INTO DB1.TABLE1 SELECT * FROM DB2.TABLE1". Replace DB1 and DB2 with your database names, and TABLE1 with the name of the table you are trying to merge.
- Click "Go".
SSH/Shell
- From SSH, type the command to access mysql, "mysql -u MYNAME -pPASS", replacing MYNAME and PASS with your username and password.
- Now enter this command, again replacing DB1, DB2, and TABLE1 with the names of your databases and the table you wish you merge. "INSERT INTO DB1.TABLE1 SELECT * FROM DB2.TABLE1;"
- repeat for any other tables you wish to merge.
Note: If you wish to have the data in DB2 overwrite the data in DB1 and they share a primary/unique key, use "REPLACE INTO" rather than "INSERT INTO"
Exporting
- In phpMyAdmin, select an existing database.
- Click "export", at the top.
- Select "Save as file" and click "Go". An .sql file will be downloaded to your computer.
Â
Importing
- In phpMyAdmin, select "Import".
- Browse for the .sql file on your computer, and select it.
- Click "Go".
If you have any issues, there is a more in-depth article about importing in the knowledgebase.