Importing data into a MariaDB or MySQL database on your hosting account is a common task when migrating a website, restoring a backup, or setting up an application manually. cPanel provides phpMyAdmin for this, and you can also import via SSH for larger files.
Make sure your database and user exist
Before importing, you need a database to import into. In cPanel, go to Databases > MySQL Databases, create a new database, create a user, and add the user to the database with "All Privileges." See How to Add a User to a Database.
01. Import via phpMyAdmin (Recommended)
- Log into cPanel at my.ultrawebhosting.com
- Go to Databases > phpMyAdmin
- Select your database from the left sidebar
- Click the "Import" tab at the top
- Click "Choose File" and select your
.sqlfile - Leave the format set to "SQL"
- Click "Go"
phpMyAdmin will read the SQL file and execute all the statements (CREATE TABLE, INSERT, etc.) to recreate the database structure and data.
phpMyAdmin has an upload limit (typically 50-256MB depending on server configuration). If your SQL file is larger than this, you will get an error. Use the SSH method below for large files, or compress your SQL file as .sql.gz and import the compressed version (phpMyAdmin can decompress on the fly).
02. Import via SSH Command Line
For large databases or when phpMyAdmin times out, import directly via the command line. You will need SSH access enabled on your account.
- Upload the SQL file to your account via FTP or File Manager
- Connect via SSH
- Run the import command:
mysql -u dbuser -p dbname < /path/to/file.sql
Replace dbuser with your database username, dbname with your database name, and the path with where you uploaded the file. You will be prompted for the database user's password.
For compressed files:
gunzip < file.sql.gz | mysql -u dbuser -p dbname
03. Handling Large Database Files
- Compress first - SQL files compress extremely well (often 10:1 or better). Compress with
gzip database.sqlbefore uploading. - Split large files - If a single SQL file is very large, you can split it into smaller chunks. Tools like
mysqldump --max_allowed_packetcan help manage this during export. - Increase timeout - If phpMyAdmin times out, the SSH method has no timeout limit and is always more reliable for large imports.
04. Common Import Errors
- "Access denied for user" - Wrong username or password, or the user does not have permissions on the database. Verify in cPanel > MySQL Databases that the user is assigned to the database.
- "Table already exists" - The database already has tables with the same names. Either drop the existing tables first (if you want to replace them) or import into a fresh, empty database.
- "MySQL server has gone away" - The import file is too large or a single query is too long. Try the SSH import method instead.
- "Unknown database" - The database name is wrong or it does not exist yet. Create it in cPanel first.
- Incorrect format / syntax errors - The file may not be a valid SQL dump. Make sure it was exported properly. See How to Back Up a MySQL Database for proper export procedures.
If you are migrating a WordPress site, the easiest approach is to use a migration plugin like All-in-One WP Migration or Duplicator rather than importing the database manually. These plugins handle the database import, file transfer, and URL rewriting all in one step. See How to Migrate Your Website.
Need Help With a Database Import?
If you are stuck on an import error or need to migrate a large database, our support team can assist.
Open a Support TicketFrequently Asked Questions
How do I import a database on my hosting?
Use phpMyAdmin in cPanel: select the target database, open the Import tab, choose your .sql file, and run it. For large files, import over SSH with the mysql command instead, since phpMyAdmin has an upload size limit.
How do I import a large database that phpMyAdmin rejects?
Use SSH: upload the .sql file, then run mysql -u user -p dbname < file.sql. The command line has no upload size limit, so it handles large dumps that exceed phpMyAdmin's cap. Use the full prefixed database name and user.
Why does my database import fail or error?
Common causes are the database not existing yet, the user lacking privileges, a file larger than phpMyAdmin's limit, or a dump with CREATE DATABASE lines that conflict with the prefixed name. Create the database first, use SSH for large files, and read the error phpMyAdmin reports.
Do I need to create the database before importing?
Yes. Create the database and a user in cPanel MySQL Databases first, assign the user to it, then import your .sql into that database. The import populates tables into an existing database; it does not create the account database for you.
Quick Recap
- Create the database and user first - cPanel > MySQL Databases
- Use phpMyAdmin for small/medium files - Import tab > Choose File > Go
- Use SSH for large files -
mysql -u user -p dbname < file.sql - Compress large SQL files - gzip before uploading, phpMyAdmin can handle .sql.gz
- WordPress migrations are easier with plugins - All-in-One WP Migration or Duplicator
Database management on shared hosting · Last updated November 2026 · Browse all PHP/MySQL articles
