Key facts
- Plain text, often UTF-8; dumps range from a few KB to many GB and are frequently compressed as .sql.gz.
- MIME type is application/sql (RFC 6922), though servers often send text/plain.
- SQL dialects differ: a MySQL dump with backtick quoting and ENGINE=InnoDB will not import into PostgreSQL or SQLite unchanged.
- Dumps can contain DEFINER clauses, SET statements and comments like /*!40101 ... */ that only MySQL-compatible servers understand.
- Created by mysqldump, pg_dump, phpMyAdmin, Adminer, WordPress backup plugins and hosting control panels.
How to open a .sql file
View it in VS Code or Notepad++ (large dumps open better in a dedicated large-file editor). Import it with MySQL Workbench, HeidiSQL or mysql -u user -p dbname < dump.sql.
Open it in a code editor, or import with TablePlus, Sequel Ace or mysql -u user -p dbname < dump.sql in Terminal.
Inspect it with less dump.sql, import into MySQL/MariaDB with mysql -u user -p dbname < dump.sql, or into PostgreSQL with psql -d dbname -f dump.sql.
Common problems and fixes
- "ERROR 1064 (42000): You have an error in your SQL syntax"
- The statement uses syntax your server version or dialect does not support, or the file is truncated. Go to the reported line and compare it with your server version; reserved words used as names need backticks.
- "Unknown collation: 'utf8mb4_0900_ai_ci'"
- The dump came from MySQL 8 and you are importing into MariaDB or MySQL 5.7. Replace utf8mb4_0900_ai_ci with utf8mb4_unicode_ci throughout the file and import again.
- "MySQL server has gone away" or packet too large
- A single INSERT is bigger than max_allowed_packet. Raise max_allowed_packet on the server (and the client with --max_allowed_packet=512M), or import from the command line instead of phpMyAdmin.
- phpMyAdmin import times out or rejects the file size
- Upload limits come from upload_max_filesize, post_max_size and max_execution_time. Compress the file to .sql.gz, raise those limits, or import with the mysql command line.
- "Access denied; you need SUPER privilege" because of DEFINER
- Views, triggers or routines are tied to a user that does not exist on the new host. Remove or change the DEFINER=`user`@`host` clauses before importing.
Often converted to or from: CSV, SQLite database, JSON, PostgreSQL dump