How to Upload a Large Database Using cPanel Terminal

When uploading a database via phpMyAdmin, you may encounter an error if the database size exceeds 256 MB. This limitation can prevent you from successfully uploading your database. 

As shown in the provided picture, the maximum allowed database size is 256 MB. Therefore, when attempting to upload a file that exceeds this limit, we encounter the following error.

To overcome this limitation, you can upload your large database using the cPanel terminal. This method allows you to bypass the size restrictions and upload your database without issues.

Step-by-Step Guide to Upload Database Using Terminal:

Create Your Database and User

Make sure you have your database created and a user attached to it. Note down the database name, username, and password as you will need this information later.

Upload Your SQL File to File Manager (Public_html folder)

Upload your SQL file to the public_html folder of your File Manager. Remember the file location as you will need it in the next steps.

Open Terminal on cPanel

Login to your cPanel , then search for terminal in search bar and Click on it. You may also find it in Advanced Section at dashboard.

 

Navigate to the Directory Containing Your SQL File

Use the cd command to navigate to the directory where you uploaded your SQL file. For example, if you uploaded the file to your public_html folder, you would run:

cd public_html

Import the Database Using MySQL Command

Use the following command to import your database. Replace userna5_db with your cPanel username and database name, userna5_user with your cPanel user and database user, and yoursqlfile.sql with your SQL file name:

mysql -p -u userna5_user userna5_db < yoursqlfile.sql

This will prompt you for a password. Enter the password you used when creating the MySQL user associated with the database.

 

By following these steps, you can successfully upload and import a large database using the terminal, bypassing the limitations of PHPMyAdmin.

Tips and Troubleshooting

  • Verify Your Database Name and Credentials: Make sure you use the correct database name and credentials to avoid connection errors.
  • Check File Permissions: Ensure the database file has the appropriate permissions for access.
  • Monitor the Import Process: Keep an eye on the terminal to ensure the import process completes without errors.
Was this answer helpful? 0 Users Found This Useful (0 Votes)