Importing a database backup with phpMyAdmin

phpMyAdmin can import an SQL backup into a selected database. The file may create, replace or delete tables depending on its statements, so inspect its purpose and take a current backup before importing into an existing application.

What you need before you begin

Create the destination database and authorised user through your hosting panel when needed. Check the dump’s source application, database version, character set and size. For migration, use an empty destination unless the application explicitly supports merging data.

01 Import a database backup with phpMyAdmin

  1. Open phpMyAdmin from the hosting panel and select the exact destination database in the left navigation.
  2. Choose Import, select the trusted SQL or supported compressed SQL file, and confirm the format. Do not upload a database dump to a public website folder.
  3. Review any import options required by the dump’s instructions. Avoid changing character-set or compatibility settings at random to bypass an error.
  4. Start the import and wait for its final result. If it stops partway, record the first error and treat the database as potentially partially imported.
  5. Check the resulting tables, then update the application’s database connection only after the destination is ready. Test sign-in, representative records and character display.

02 Example: confirm the selected database before importing

In phpMyAdmin, select the intended destination database and open its SQL tab. These read-only statements confirm the selection and show its current tables. They do not create, clear or repair anything.

SQL example
SELECT DATABASE() AS selected_database;
SHOW TABLES;

Check the displayed database name against the destination recorded in your migration plan. If it is empty or wrong, stop and select the correct database. Save an export of existing data before using a file that contains statements which replace tables or rows.

After the import, compare the resulting table list and important records with the file's documented expectations. A transactional updater may require tables that already exist, while an installer may create missing structures. Use the file intended for that state and preserve its session requirements instead of deleting more tables to bypass an error.

Confirm the expected result

Compare expected table counts and key records with the source. A green import notice does not prove the application points to the right database or that the dump included every required object.

What should I do when a phpMyAdmin import reaches a limit or fails partway?

For upload or execution limits, use an approved server-side import or ask support rather than repeatedly resuming blindly. SQL scripts requiring session temporary tables or one transaction must remain in one session. Restore the pre-import backup if an existing database was changed incorrectly.

Sources and further reading

  • 0 Users Found This Useful
  • development, backups
Was this answer helpful?

Related Articles

Exporting a recoverable database backup in phpMyAdmin

An SQL export saves database structure and data in a form that can be restored later. Download...

Editing one database row safely in phpMyAdmin

phpMyAdmin can change individual records, but direct edits bypass an application’s validation...

Deleting an unused database table with phpMyAdmin

Dropping a table permanently removes its structure and stored rows. Use this only for a table...

When and how to optimise a table in phpMyAdmin

Table optimisation can reclaim or reorganise storage after substantial data changes, depending...

Can phpMyAdmin repair a damaged database table?

Only some storage engines support the SQL REPAIR TABLE operation. InnoDB tables are not...