This section explains how to make use of the code editors in MySQL for Visual Studio.
MySQL for Visual Studio provides access to MySQL objects and data without forcing developers to leave Visual Studio. Designed and developed as a Visual Studio package, MySQL for Visual Studio integrates directly into Server Explorer providing a seamless experience for setting up new connections and working with database objects.
The following MySQL for Visual Studio features are available as of version 2.0.2:
A newer user interface for displaying query results, where different views are presented from result sets returned by a MySQL server like:
Multiple tabs for each result set returned by an executed query.
Results view, where the information can be seen in grid, tree, or text representation for JSON results.
Field types view, where information about the columns of a result set is shown, such as names, data types, character sets, and more.
Query statistics view, displaying information about the executed query such as execution times, processed rows, index and temporary tables usage, and more.
Execution plan view, displaying an explanation of the query execution done internally by the MySQL server.
The minimum requirements are:
MySQL for Visual Studio 2.0.5
Visual Studio 2012
MySQL 5.7.12 with X Plugin enabled (Code editors are not supported for use with MySQL 8.0 servers.)
To enable X Plugin for MySQL 5.7:
Open a command prompt and navigate to the folder with your MySQL binaries.
Invoke the mysql command-line client:
mysql -u user -p
Execute the following statement:
mysql> INSTALL PLUGIN mysqlx SONAME 'mysqlx.dll';Important
mysql.sessionuser must exist before you can load X Plugin.
mysql.sessionwas added in MySQL 5.7.19. If your data dictionary was initialized using an earlier version you must run the mysql_upgrade procedure. If the upgrade is not run, X Plugin fails to start with the following error message:
There was an error when trying to access the server with user: mysql.session@localhost. Make sure the user is present in the server and that mysql_upgrade was ran after a server update.
Before opening a code editor that can run scripts against a MySQL server, a connection needs to be established:
Open the Server Explorer pane by clicking.
Right-click the Data Connections node and select Add Connection.
In the Add Connection window, make sure the MySQL Data Provider is being used and fill in all the information.Note
To enter the port number, clickand set the Port among the list of connection properties.
Clickto ensure you have a valid connection, then click . The new connection with its tables, views, stored procedures, and functions now appears within the Data Connections list of Server Explorer.
To create a new editor for existing MySQL connections, you need only to do the last step.
An open editor includes a toolbar with the actions that can be executed. The first two buttons in the toolbar represent a way to connect or disconnect from a MySQL server. If the editor was opened from the Server Explorer, the connection will be already established for the new script tab.
The third button is thebutton, the script contained in the editor window is executed by clicking it and results from the script execution are displayed in the lower area of the script tab.