devkult_
tools29converters34
home/mime/.sql

.sql MIME type

SQL scripttext & code

application/sql

SQL scripts, registered by RFC 6922.

MIME typeapplication/sql
Extensions.sql
Content-Typeapplication/sql; charset=utf-8
Compress in transit?Yes — enable gzip or Brotli

Good to know

  • Rarely served over HTTP; you mostly meet this type in upload validation and editor configuration.
  • Never serve database dumps from a public web directory — they're a common source of data leaks.

Useful here: SQL formatter

Serve .sql files with the right type

The response header to send:

Content-Type: application/sql; charset=utf-8

Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:

nginx (inside the types block in mime.types)
application/sql sql;
Apache (.htaccess or server config)
AddType application/sql .sql
Express
res.set("Content-Type", "application/sql; charset=utf-8");
Python
import mimetypes

mimetypes.add_type("application/sql", ".sql")
HTML file input
<input type="file" accept=".sql,application/sql">

Check it

See what a server sends for a file, and what type a local file really is by its contents:

curl -sI https://example.com/file.sql | grep -i '^content-type:'
file --mime-type file.sql

Frequently asked questions

What is the MIME type for .sql files?

application/sql.

What Content-Type header should a .sql file be served with?

Content-Type: application/sql; charset=utf-8. As a text format, include the charset so browsers don't guess the encoding. It compresses well, so let the server apply gzip or Brotli.

Related types

Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options