Database

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.

Screenshot 74

 

As shown in the provided picture, the maximum allowed database size is 50 MB.

Therefore, when attempting to upload a file that exceeds this limit, we encounter the following error.

2 Capture

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

Log in to your cPanel, then search for “terminal” in the search bar and click on it. You may also find it in the Advanced Section of the dashboard.

Screenshot 75

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.

Screenshot 76

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.
Share this Doc

How to Upload a Large Database Using cPanel Terminal

Or copy link

CONTENTS
Order Services