This article was co-authored by wikiHow Staff. Our trained team of editors and researchers validate articles for accuracy and comprehensiveness. wikiHow's Content Management Team carefully monitors the work from our editorial staff to ensure that each article is backed by trusted research and meets our high quality standards.
This article has been viewed 95,594 times.
Learn more...
This wikiHow teaches you how to open and view the contents of a SQL (Structured Query Language) data file. SQL files contain specific code to modify the contents of a relational database and database structure. You can open a SQL file in MySQL Workbench if you want to use MySQL's tools for your database's development, administration, design, and other maintenance tasks. If you just want to view and manually edit your code quickly, you can use a simple text editor like Notepad or TextEdit.
Steps
Method 1
Method 1 of 2:Using MySQL Workbench
-
1Open the MySQL Workbench app on your computer. The MySQL Workbench icon looks like a dolphin in a blue square. You can find it on your Start menu on Windows or in the Applications folder on Mac.
- If you don't have MySQL Workbench installed on your computer, you can select your system, and download the app installer at https://dev.mysql.com/downloads/workbench.
-
2Double-click a model or database under "MySQL Connections." You'll find your available model instances here. Just double-click the one you want to use.
-
3Click the File tab on the top-left. This button is in the upper-left corner of your screen. It will open a drop-down menu.
-
4Click Open SQL Script on the File menu. This will open a new file navigator window, and allow you to select the SQL file you want to open.
- Alternatively, press Ctrl+⇧ Shift+O (Windows) or ⌘ Cmd+⇧ Shift+O (Mac) on your keyboard.
-
5Find and click the SQL file you want to open. Use the file navigator window to find your SQL file, and click on its name to select the file.
-
6Click Open on the bottom-right. This button is in the lower-right corner of the file navigator pop-up. It will open your SQL file's contents in the MySQL Workbench app.
- You can view and edit your SQL script here.
Method 2
Method 2 of 2:Using a Text Editor
-
1Find and right-click the SQL file. This will open your right-click options on a drop-down menu.
-
2Hover over Open with on the right-click menu. This will open a list of recommended applications to open this file.
-
3Select Notepad (Windows) or TextEdit (Mac). This will open your SQL file in your text editor. You can easily view and manually edit the SQL script in the text editor here.
- If you don't see Notepad or TextEdit here, click Choose another app or Other at the bottom. This will open a list of all your applications.
About This Article
1. Open MySQL Workbench.
2. Double-click a model under "MySQL Connections."
3. Click File on the top-left.
4. Click Open SQL Script.
5. Select your SQL file.
6. Click Open.

























































