# .sql MIME Type: application/sql

> SQL scripts, registered by RFC 6922.

- MIME type: `application/sql`
- Extensions: .sql
- Content-Type header: `application/sql; charset=utf-8`
- Compress in transit: yes

## 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.

## Server configuration

### 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">
```

## FAQ

### 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

- [.csv — text/csv](https://www.devkult.com/mime/csv.md)
- [.txt — text/plain](https://www.devkult.com/mime/txt.md)

Open the interactive page: https://www.devkult.com/mime/sql