Skip to main content

How to import and export databases in phpMyAdmin

How to import a database into phpMyAdmin and export an existing database as a backup.

phpMyAdmin makes it easy to import and export MySQL and MariaDB databases directly from your browser. This is useful when moving a website between servers, restoring a backup, or taking a copy of the database before making major changes.

Overview

phpMyAdmin contains built-in tools for both import and export of databases.

This feature has several advantages. You can:

  • Upload and restore databases from backups

  • Export databases to SQL files

  • Move websites between servers

  • Create manual backups of databases

  • Use it without a command line or any additional software

When you finish this guide, you will know how to export a database to a file and how to import a database back to phpMyAdmin.


Important information

An exported database is usually stored as an SQL file that contains tables, structure, and data from the database.

During the import, existing data in the database could be overwritten, depending on the content of the imported SQL file.

⚠️ Important: We always recommend making a backup of the database before importing a new database file or making major changes.


Prerequisites

Before you start, make sure:

  • You have access to cPanel

  • You have access to phpMyAdmin

  • You have an existing database

  • You have the database file available if you are going to import a database


Step 1: Log in to cPanel

If your hosting service supports cPanel, you can log in directly from the landing page in the client area.

This is how you do it:

  • Find your hosting service under the list of active products/services

  • Click on the button "Log in to cPanel"

  • You are now automatically logged into cPanel without having to enter your username or password again


Step 2: Open phpMyAdmin

Click on phpMyAdmin.

You are now redirected to phpMyAdmin.

Step 3: Export a database

To download a copy of the database:

  1. Select the database you want to export from the menu on the left side.

  2. Click on the Export tab at the top of phpMyAdmin.

3. Select the Export Method:

  • Quick – Default settings suitable for most users

  • Custom – Advanced export settings

4. Select SQL as a file format.

5. Click on Export.

Your browser will now download a SQL file that contains the database.

💡 Tip: Store exported database files in a secure location so that they can be used as a backup if needed.


Step 4: Import a database

To import a database from an SQL file:

6. Select the database you want to import the data to.

7. Click the Import tab at the top of phpMyAdmin.

8. Click on Choose File

9. select the SQL file from your computer.

10. Click on Open

11. Make sure that the format is set to SQL.

12. Click Import to start import.

phpMyAdmin will now upload and import the database.

When the import is complete, a confirmation message appears at the top of the page.

⚠️ Important: If the database already contains tables of the same name as in the SQL file, the import can lead to errors or overwrite existing data.

Step 5: Confirm that imports or exports were successful

After an import, you can make sure that the tables appear in the database by selecting the database in the menu on the left.

If the tables appear and no error messages were displayed during the import, the database should be imported correctly.

💡 Tip: Test the website or application after import to confirm that the database is working as expected.


Summary

You have now learned how to export and import databases using phpMyAdmin.

The export function makes it easy to create manual backups of databases, while the import function allows you to restore or move databases between different servers and hosting accounts. Regular backups provide extra security if something goes wrong with the website or database.

Did this answer your question?