Export a database and import it somewhere else

Move a MySQL database between hosts or into a new database with phpMyAdmin, handling the errors imports commonly hit.

TutorialIntermediate25 min to completeLast updated
On this page
  1. What you’ll need
  2. Step 1: Export from the source
  3. Step 2: Check the export
  4. Step 3: Remove database-specific lines if present
  5. Step 4: Create the target database
  6. Step 5: Import
  7. Step 6: Compare
  8. Step 7: Update the application
  9. Check it worked
  10. If something goes wrong
Level
Intermediate
Time
About 25 min
Steps
7
You’ll finish with
A working result, checked

7 steps

What you’ll need

  • phpMyAdmin access on the source
  • DirectAdmin access on Traxio

Whether you’re migrating a site or making a copy for testing, the process is the same: export cleanly, prepare an empty target, import, and update the application.

Step 1: Export from the source

In the source phpMyAdmin, select the database, Export → Custom, format SQL, compression gzipped. How to export a database (backup with phpMyAdmin)

Step 2: Check the export

Confirm the file isn’t tiny. Decompress a copy and look for CREATE TABLE lines.

Step 3: Remove database-specific lines if present

If the file contains CREATE DATABASE or USE \oldname\``, delete those lines — they point to the old database name.

Step 4: Create the target database

On Traxio, create a new database and user. How to create a MySQL database in DirectAdmin

Step 5: Import

Open Extra Features › phpMyAdmin, select the new database first, then Import your file. How to import a database with phpMyAdmin

Step 6: Compare

Check the table list matches the source, and compare row counts for two or three important tables.

Step 7: Update the application

Change the database name, user and password in the application’s config file. Host is localhost.

Check it worked

The table count and key row counts match the source, and the application loads data from the new database.

If something goes wrong

What happensWhat to do
Unknown collation utf8mb4_0900_ai_ciReplace with utf8mb4_unicode_ci in the file. MySQL vs MariaDB: what’s the difference?
#1044 access denied to databaseThe file references the old database name; remove CREATE DATABASE/USE lines.
Timeout or file too largeImporting a database that’s too large for phpMyAdmin

This works on any Traxio account. If you’re still choosing a host, PHP and MySQL hosting is £0.99 a month.

Where this fits: DirectAdmin hosting explains the control panel every Traxio account uses, with a tour and tutorials.

Spotted something out of date or unclear? Tell us and we’ll fix it.

Keep going