How to Import a WordPress Database Using cPanel Terminal (Step-by-Step)

If you need to upload a large database or want a faster alternative to phpMyAdmin, using the cPanel Terminal is a reliable and efficient method.

This guide walks you through the complete process.


Prerequisites

Make sure:

  • Your database file is uploaded to: /home/websitepath/public_html/database.zip
  • You have your database details ready:
Database: website_database
User: database_user

Step 1: Open cPanel Terminal

Go to cPanel → Terminal. It will open in your home directory:

/home/websitepath

Step 2: Navigate to File Location

Move to the directory where your database file is stored:

cd public_html

Verify the file exists:

ls -lh database.zip

Step 3: Extract the Database File

Unzip the file:

unzip database.zip

This will extract a .sql file (for example: softsql.sql).

Confirm extraction:

ls -lh *.sql

Step 4: Import the Database

Run the following command:

mysql -u database_user -p website_database < softsql.sql
  • Enter your database password when prompted
  • No characters will appear while typing — this is normal

If successful, the terminal will return to the prompt without errors.


Alternative: Import Without Unzipping

You can skip extraction and import directly:

unzip -p database.zip | mysql -u database_user -p website_database

This method is faster and avoids creating extra files.


Verify the Import

To confirm everything worked:

  • Go to cPanel → phpMyAdmin
  • Select your database
  • Check if tables are listed correctly

Conclusion

Using cPanel Terminal for database import is faster, more reliable for large files, and avoids common phpMyAdmin limitations like upload size or timeout issues.

This method is especially useful for developers handling migrations or large WordPress databases.


Tip: If you encounter errors during import, check file permissions, database credentials, and SQL file integrity.