Toolman

.sql — SQL Script

Data application/sql

What a .sql file is

Plain-text database statements — either schema definitions or a full dump of data as INSERT statements.

How to open it

Any text editor, or piped into a database client: mysql < dump.sql, psql -f dump.sql.

Worth knowing

Dumps of large tables get enormous. Compress them, and check the file starts with the statements you expect before running it against anything.

How to identify a .sql file

A file's extension is only its name — renaming a.png to a.sql changes nothing inside. What software actually reads is the magic number, the first few bytes of the file.

Signaturenone
MIME typeapplication/sql
CategoryData

Plain text.

# what is this file really?
file mystery.sql

# look at the first bytes yourself
xxd mystery.sql | head -2
head -c 16 mystery.sql | xxd

# Windows PowerShell
Get-Content mystery.sql -AsByteStream -TotalCount 16 | Format-Hex

Frequently asked questions

What is a .sql file?

Plain-text database statements — either schema definitions or a full dump of data as INSERT statements.

How do I open a .sql file?

Any text editor, or piped into a database client: mysql < dump.sql, psql -f dump.sql.

Is .sql safe to open?

Yes. A .sql file is data, not code — opening one cannot execute anything by itself.

Can I change a file's extension to convert it?

No. Renaming changes the label, not the bytes. The one place it appears to work is between formats that genuinely share a container — renaming .docx to .zip works because a DOCX is a ZIP. Everything else needs a real converter.

Other data formats

Other formats

All file formats