MySQL for Visual Studio  /  Editing  /  MySQL SQL Editor

5.1 MySQL SQL Editor

The MySQL SQL Editor can be opened from the MySQL toolbar or by clicking File, New, and File from the Visual Studio main menu. This action displays the New File dialog.

Figure 5.1 MySQL SQL Editor - New File

MySQL SQL Editor - New File

From the New File dialog, select the MySQL template, select the MySQL Script document, and then click Open.

The MySQL SQL Editor will be displayed. You can now enter SQL code as required, or connect to a MySQL server. Click the Connect to MySQL button in the MySQL SQL Editor toolbar. You can enter the connection details into the Connect to MySQL dialog that is displayed. You can enter the server name, user ID, password and database to connect to, or click the Advanced button to select other connection string options. Click the Connect button to connect to the MySQL server. To execute your SQL code against the server, click the Run SQL button on the toolbar.

Figure 5.2 MySQL SQL Editor - Query

MySQL SQL Editor - Query

The results from queries are displayed in the Results tab and relevant information appears in the MySQL Output pane. The previous example displays the query results within a Result Grid. You can also select the Field Types, Execution Plan, and Query Stats for an executed query.