Skip to main content

How to Import a MySQL Database With phpMyAdmin

You can import a MySQL database into your cPanel account using the phpMyAdmin tool. This process allows you to move a database from one location to another or restore a database from a previously exported file.

You can import a MySQL database into your cPanel account using the phpMyAdmin tool. This process allows you to move a database from one location to another or restore a database from a previously exported file.

Before you begin

You will need:

  • A cPanel account

  • A valid .sql or .sql.gz file containing your database data

  • The name of the target database and the specific database name (e.g., username_dbname)

Import your database

  1. Log in to your cPanel account.

  2. Under the Databases section, select phpMyAdmin.

  3. In the left-hand sidebar of phpMyAdmin, click the name of the database you wish to populate.

  4. Click the Import tab at the top of the page.

  5. Click Choose File and select your .sql or .sql.gz file from your local computer.

  6. Leave the other settings at their default values unless you have specific requirements for the character set or SQL format.

  7. Click Go (or Import) at the bottom of the page.

Confirm the result

  • phpMyAdmin will display a success message indicating the number of queries executed and the time taken.

  • You can verify the import by clicking on the database name in the left sidebar and checking that the tables are listed and populated with data.

If the import fails due to "Server has no available tables" or "MySQL has gone away"

These errors often occur when the file size exceeds the maximum limit allowed by the server's PHP configuration.

To resolve this:

  • If the file is large, try compressing it into a .gzip format before uploading.

  • If the file is very large (typically over 50MB), contact Hostek support to perform a manual import via the command line.

Limitations

  • The file size limit for imports via phpMyAdmin is determined by your server's PHP configuration.

  • This process does not automatically create the database or the database user; those must be created in cPanel before you can import data into them.

  • If the SQL file contains "CREATE DATABASE" or "USE" commands for a different database name, the import may fail or import into the wrong location. Ensure your export file only contains the data and table structures.

Did this answer your question?