Database Migration Between Servers: Export, Import and Fix Character Sets
Use a full dump, a matching character set and a clean import, then test the application.
Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.
Steps
- Export with phpMyAdmin or
mysqldump, using UTF-8. - Create the new database and user on the new server. See Create a MySQL Database and User in Your Hosting Panel (and Why the User Needs Privileges).
- Import the file. If it is large, use the command line or the host's tool. See phpMyAdmin Import Fails: File Too Large or Script Timed Out.
- Update the application's config with the new host, name, user and password.
- If the site URL changed, update stored URLs safely.
- Test key pages, login and forms.
Tips
Keep the old database until the new one is proven. Check table collations after import. See WordPress Emoji, Smart Quotes or Special Characters Show as Question Marks.
Related guides
- WordPress: Clone a Site to a Subdomain for Testing
- Rollback Plan: How To Undo a Change in 5 Minutes
- Restore One File or One Database Table From a Backup Without Rolling Back Everything
- phpMyAdmin Import Fails: File Too Large or Script Timed Out
Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.