How do I import into a MariaDB - MySQL database?

PHP/MySQL | Updated 2026

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.

01. Import via phpMyAdmin (Recommended)

  1. Log into cPanel at my.ultrawebhosting.com
  2. Go to Databases > phpMyAdmin
  3. Select your database from the left sidebar
  4. Click the "Import" tab at the top
  5. Click "Choose File" and select your .sql file
  6. Leave the format set to "SQL"
  7. Click "Go"

phpMyAdmin will read the SQL file and execute all the statements (CREATE TABLE, INSERT, etc.) to recreate the database structure and data.

File Size Limit

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.

  1. Upload the SQL file to your account via FTP or File Manager
  2. Connect via SSH
  3. 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.sql before uploading.
  • Split large files - If a single SQL file is very large, you can split it into smaller chunks. Tools like mysqldump --max_allowed_packet can 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.
Tip

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 Ticket

Quick Recap

  1. Create the database and user first - cPanel > MySQL Databases
  2. Use phpMyAdmin for small/medium files - Import tab > Choose File > Go
  3. Use SSH for large files - mysql -u user -p dbname < file.sql
  4. Compress large SQL files - gzip before uploading, phpMyAdmin can handle .sql.gz
  5. WordPress migrations are easier with plugins - All-in-One WP Migration or Duplicator

Database management on shared hosting · Last updated March 2026 · Browse all PHP/MySQL articles

  • 526 Users Found This Useful

Was this answer helpful?

Related Articles

PHP system exec Functions Disabled on Shared Hosting

PHP/MariaDB/MySQL | Updated March 2026 The error "Warning: system() has been disabled for...

What Port is MariaDB/MySQL On?

PHP/MariaDB/MySQL | Updated 2026 MariaDB/MySQL runs on port 3306 by default on all Ultra Web...

What is the proper MariaDB - MySQL import and export format?

PHP/MySQL | Updated 2026 When importing or exporting MariaDB/MySQL databases, the format...

Increase PHP Memory

PHP/MySQL | Updated 2026 If your website shows a "Fatal error: Allowed memory size exhausted"...

Useful CSV to MySQL Script

PHP/MySQL | Updated 2026 Importing CSV data into a MySQL/MariaDB database is a common task...



Save 30% on web hosting - Use coupon code Hosting30