Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to open an SQL file in Windows

This guide shows you how to look inside an SQL file on a Windows computer.

Databases2 min read8 steps7 screenshots

What is an SQL file?

A database stores the data for a website. An SQL file is a saved copy of a database, written as plain text. It holds commands in SQL, the language databases understand. You get one when you export or back up a database. Its name ends in .sql.

Because it is plain text, you can read it with a simple program. You do not need to load it into a database just to look.

Open it with Notepad

  1. Find the file in File Explorer.
    Screenshot: Find the file in File Explorer.
  2. Right-click the file.
  3. Choose Open with, then Notepad.

If you do not see Notepad, click Choose another app and pick it from the list.

Notepad is fine for small files. Big files, such as 100 MB or more, can freeze it.

Screenshot: Notepad is fine for small files. Big files, such as 100 MB or more, can freeze it.

Better choices for big files

  • Notepad++: a free text editor that handles large files better. It also colours SQL words to make them easier to read.
  • Visual Studio Code: a free editor from Microsoft with SQL colouring.
  • EmEditor: built for very large text files.

For these, download and install the program first. Then right-click the file and choose Open with.

Run the file in a database

If you want to load the data instead of just reading it, import it.

  1. Open phpMyAdmin from cPanel.
  2. Click the target database on the left.
  3. Click the Import tab.
  4. Click Choose File and pick your SQL file.
    Screenshot: Click Choose File and pick your SQL file.
    Screenshot: Click Choose File and pick your SQL file.
  5. Click Go.

You can also use MySQL Workbench. It is a free desktop tool for databases. Use File, then Open SQL Script, and click the lightning bolt to run it.

Screenshot: You can also use MySQL Workbench. It is a free desktop tool for databases. Use File , then

Warning: Running an SQL file can change or delete data. Read what it does first. Take a backup before you import into a live database. Only open files you trust.

Tip: If a file ends in .sql.gz or .zip, it is compressed. Right-click it and extract it first.

Need help with an import? Open a support ticket.

Quick recap

  • An SQL file is a text copy of a database.
    Screenshot: An SQL file is a text copy of a database.
    Screenshot: An SQL file is a text copy of a database.
  • Open it with Notepad for small files.
  • Use Notepad++ or VS Code for large files.
  • To load the data, import it with phpMyAdmin or MySQL Workbench.
  • Back up before importing.