Moving data without losing any.
THE PROCEDURE
- Export the source database with mysqldump, or phpMyAdmin for a small one.
- Create the destination database and user, granting privileges.
- Import the dump.
- Update the application configuration with the new credentials, remembering the cPanel prefix.
- Run a search and replace if the domain changed.
- Verify.
THE PREFIX
Database and user names on cPanel carry your username as a prefix. A dump from another host has different names, and the application configuration must be updated to match the new ones.
FOR LARGE DATABASES
Use the command line. phpMyAdmin will time out.
Compress the dump for transfer.
SEARCH AND REPLACE
If the domain changed, URLs stored in the database must be updated. For WordPress, use a tool that handles serialised data; a raw SQL replace corrupts it.
FOR A SITE STILL TAKING ORDERS
Freeze writes during the final sync, or orders placed after your copy are lost.
VERIFYING
Compare row counts on key tables. Then test the application properly.