How to Import a SQL File Using phpMyAdmin
You can import SQL dumps, CSV files, and other formats directly through phpMyAdmin's import interface.
Step by Step
- In phpMyAdmin, select the target database from the left sidebar. If the database doesn't exist yet, create it first (click New in the sidebar).
- Click the Import tab at the top of the page.
- Click Choose File and select your SQL file.
- Leave the default settings unless you know you need to change them:
- Character set: utf8mb4 is the safest default.
- Format: SQL (auto-detected in most cases).
- Click Go.
phpMyAdmin will execute the SQL statements in your file. When it's done, you'll see a success message with the number of queries executed.
Upload Limit
DBEverywhere's phpMyAdmin has a file upload limit (typically around 50MB). If your file exceeds this, phpMyAdmin will reject it. See phpMyAdmin Upload / Import Limit for alternatives.
phpMyAdmin can import compressed files (.sql.gz, .sql.zip) directly, which helps you stay under the limit.
For Large Files
If your import file is too large for phpMyAdmin, use the MySQL command line:
mysql -h your-host -u your-username -p your-database-name < file.sql
This has no size limit and runs significantly faster for large imports.
Common Errors
"Script timeout" — The file is too large for phpMyAdmin to process within the PHP time limit. Use the command line method above.
"Incorrect string value" or encoding errors — Your file was created with a different character set. On the import page, set the character set to match the one used when the file was exported. If unsure, try utf8mb4 or latin1.
"Table already exists" — Your SQL file contains CREATE TABLE statements for tables that already exist. Either drop the existing tables first, or edit your SQL file to use CREATE TABLE IF NOT EXISTS or add DROP TABLE IF EXISTS before each CREATE statement.
"Max allowed packet" error — A single INSERT statement in your file is larger than the server's max_allowed_packet setting. This is a server-side limit you'd need to adjust on the database itself, not in phpMyAdmin.