This article will guide you on how to open and view the contents of an SQL (Structured Query Language) data file. This file contains specific code to modify the content and structure of a relational database. You can open an SQL file using MySQL Workbench if you want to use MySQL's tools for development, administration, design, and other database-related maintenance tasks. If you only want to quickly view and manually edit the code, you can use a simple text editor like Notepad or TextEdit.
Steps
Using MySQL Workbench

Open the MySQL Workbench application on your computer. The MySQL Workbench icon looks like a dolphin inside a blue square. The application can be found in the Start menu on Windows or in the Applications folder on Mac.
- If MySQL Workbench is not installed on your computer, you can select your operating system and download the application installer from https://dev.mysql.com/downloads/workbench.

Double-click the model or database under "MySQL Connections". You will see the available model instances here. Simply double-click the one you want to use.

Click the File tab in the top-left corner. This button is located in the upper-left corner of the screen. This opens a drop-down menu.

Click Open SQL Script in the File menu. This opens a new file browser window, allowing you to select the SQL file you want to open.
- Alternatively, you can press Ctrl+⇧ Shift+O (on Windows) or ⌘ Cmd+⇧ Shift+O (on Mac) on your keyboard.

Search for and click the SQL file you want to open. Use the file browser window to locate your SQL file, then click its name to select it.

Click Open in the bottom-right corner. This button is located in the lower-right corner of the file browser window. This opens the contents of the SQL file in MySQL Workbench.
- You can view and edit the SQL script here.
Using a Text Editor

Search for and right-click the SQL file. This opens a dropdown menu with a list of options.

Hover over Open with in the menu. This displays a list of recommended applications to open the file.

Click Notepad (on Windows) or TextEdit (on Mac). This opens the SQL file in a text editor, allowing you to easily view and manually edit the SQL script.
- If you don’t see Notepad or TextEdit, click Choose another app or Other at the bottom. This will display a list of all your installed applications.
