application/sql SQL Common
Identifies SQL script files — database dumps, migrations, and query files.
What it's for
application/sql identifies SQL script files — plain text files containing SQL statements, most commonly encountered as database dumps (a full export of a database's schema and/or data as a series of CREATE TABLE and INSERT statements), migration files, or standalone query scripts. It was officially registered with IANA in RFC 6922, though text/plain and text/sql (non-standard but sometimes seen) both remain common in practice as well, since SQL files are, at their core, just plain text.
Format & syntax
Content-Type: application/sql
No special structure requirements beyond being valid SQL syntax for whichever database system it targets — SQL dialects differ meaningfully between MySQL, PostgreSQL, SQLite, SQL Server, and others, so a .sql file isn't universally portable without accounting for these dialect differences.
How it's used in practice
- Database export/import (dumps) — tools like
mysqldump,pg_dump, and similar utilities generate.sqlfiles containing the statements needed to recreate a database's schema and data, commonly used for backups, migrations between environments, or sharing a dataset. - Database migration files — many web frameworks and ORMs (Laravel's migrations being a direct example) use SQL (or SQL-adjacent, framework-specific syntax that compiles to SQL) files to version-control schema changes over time.
- Admin panel/tool "download as SQL" export features — database administration tools (phpMyAdmin, pgAdmin, TablePlus, and similar) commonly offer exporting query results or full tables as downloadable SQL scripts.
- Onboarding/seed data scripts — providing a
.sqlfile to set up a fresh local development database with sample data is a common pattern in project documentation and setup scripts.
Common mistakes & gotchas
- Assuming SQL dumps are portable across different database systems — SQL syntax has meaningful dialect differences (data types, specific functions, quoting conventions) between MySQL, PostgreSQL, SQLite, and others; a dump generated for one database system frequently needs manual adjustment before it can be imported into a different one.
- Executing untrusted SQL files without review — running an SQL script from an untrusted or unknown source directly against a database (especially a production one) without reviewing its contents first is a genuine security and data-integrity risk, since SQL scripts can contain destructive statements.
- Large SQL dump files causing import performance issues — very large database dumps (many gigabytes) can be slow or resource-intensive to import via naive methods; database-specific bulk-loading tools and techniques are often meaningfully faster than executing a dump as one giant sequential script.
- Not accounting for foreign key/dependency ordering in manually written SQL — SQL scripts creating multiple related tables or inserting related data need statements in the correct dependency order (parent tables/rows before ones that reference them via foreign keys), or execution will fail on constraint violations.
Comparison & FAQ
| Type | Purpose | Key difference from application/sql |
|---|---|---|
| text/plain | Generic unstructured text | Some tools use text/plain interchangeably for SQL files since there's no strict enforcement, though application/sql is the more descriptive, officially registered choice |
Can I import a MySQL dump directly into PostgreSQL?
Not usually without modification — SQL dialect differences (data types, specific syntax, functions) between database systems mean cross-database dump portability often requires manual adjustment or a dedicated migration tool designed for that specific conversion.
Is it safe to run a downloaded .sql file against my database?
Only after reviewing its contents — SQL scripts can contain destructive statements (DROP TABLE, DELETE, etc.), and running an untrusted script directly, especially against a production database, is a real risk worth taking seriously.
Why is importing my large SQL dump so slow?
Executing a large dump as one sequential script (statement by statement) is often much slower than using your database system's dedicated bulk-import tooling, which is typically optimized specifically for large-scale data loading.
What's the difference between application/sql and text/sql?
application/sql is the officially IANA-registered MIME type per RFC 6922; text/sql is a non-standard but occasionally seen alternative some tools use informally — both are understood as "this is SQL" in practice, but application/sql is the more technically correct choice.