Import database from phpMyAdmin


When to import a database?

Importing a database is useful when:

  • ✅ Migrating a website to another server
  • ✅ Restoring a database from backup
  • ✅ Installing an application that requires a preconfigured database
  • ✅ Updating an existing database

Prerequisites

Before importing, you need:

  • ✅ Access to phpMyAdmin
  • ✅ The SQL file to import (usually .sql or .sql.gz)
  • ✅ A created database (can be empty)
  • ✅ Sufficient permissions on the database

Step 1: Access phpMyAdmin

  • Log in to phpMyAdmin (from cPanel or directly via URL)
  • Log in with your credentials

Step 2: Select the database

  • In the left panel, click on the database where you want to import
  • If the database doesn't exist, create it first

Note: You can import to an empty database or an existing one (new data will be added or replaced depending on configuration).


Step 3: Open Import tab

  • In the top menu, click on the Import tab

Step 4: Select the file

  • Click Choose File
  • Select the SQL file from your computer
  • The file can be:
    • .sql - Uncompressed SQL file
    • .sql.gz - Gzip compressed SQL file
    • .zip - Compressed file (phpMyAdmin will automatically decompress it)

Step 5: Configure import options

Important options:

  • Format: Usually SQL (phpMyAdmin detects it automatically)
  • Partial import: For large files, phpMyAdmin will process them in parts
  • Allow interruption: If the file is very large, you can cancel
  • File format: If it's standard SQL, leave it on automatic

Character configuration:

  • Generally you can leave it on utf8 or utf8mb4
  • If the file has special characters, select the correct charset

SQL compatibility mode:

  • If the file is from an old MySQL version, you can change compatibility mode
  • Generally leave it on NONE or default mode

Step 6: Start import

  • Review the configuration
  • Click Go or Continue at the bottom
  • Wait for the import to complete

Note: For large files, the import may take several minutes.


Step 7: Verify import

After completing, verify:

  • Click on the database in the left panel
  • Verify that tables were imported correctly
  • Review some records to confirm data is correct

You should see a message like:

Import has been successfully finished, X queries executed.

Import large files

If the file is very large (more than 2MB), you may have problems. Options:

Option 1: Increase limits in phpMyAdmin

Edit php.ini file or contact support to increase:

upload_max_filesize = 50M
post_max_size = 50M
max_execution_time = 300

Option 2: Import from terminal

For very large files, it's better to use terminal:

mysql -u user -p database_name < file.sql

Option 3: Split the file

You can split the SQL file into smaller parts using tools.


Import from compressed file

If the file is compressed (.gz or .zip):

  • phpMyAdmin can decompress it automatically
  • Select the .gz or .zip file directly
  • phpMyAdmin will process it automatically

Common issues

"File too large" error

  • The file exceeds the upload limit
  • Import from terminal or increase limits
  • Or split the file into smaller parts

"MySQL server has gone away" error

  • The file is too large or the query is too complex
  • Increase max_allowed_packet in MySQL
  • Or import from terminal

SQL syntax error

  • The file may be corrupted or have errors
  • Verify that the file is valid SQL
  • Review error logs for more details

Some tables don't import

  • Verify that you have sufficient permissions
  • Check if there are errors in the import process
  • Verify that the file is complete

Tips

  • ✅ Backup current database before importing
  • ✅ Verify that the SQL file is complete and not corrupted
  • ✅ For large files, consider using terminal
  • ✅ Verify that characters import correctly (charset)
  • ✅ Test first with a test database

Need help?

If you're having trouble importing a database or the file is too large, open a ticket from the billing.baires.host panel or contact us for support.

You can also reach us through our social media:

Was this answer helpful? 0 Users Found This Useful (0 Votes)