Mysql For Visual Studio Code



Database Client for Visual Studio Code. It supports databases MySQL/MariaDB, Microsoft SQL Server, PostgreSQL, Redis, and ElasticSearch. Project site: vscode-database-client, 中文文档. Database Client. Connect; Table; Execute SQL Query; Generate Mock. Search results for 'mysql', Visual Studio Code on marketplace.visualstudio.com.

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.5:

  • JavaScript and Python code editors, where scripts in those languages can be executed to query data from a MySQL database.

  • Better integration with the Server Explorer to open MySQL, JavaScript, and Python editors directly from a connected MySQL instance.

  • 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:

  1. Open a command prompt and navigate to the folder with your MySQL binaries.

  2. Invoke the mysql command-line client:

  3. Execute the following statement:

    The mysql.session user must exist before you can load X Plugin. mysql.session was 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:

  1. Open the Server Explorer pane by clicking View.

  2. Right-click the Data Connections node and select Add Connection.

  3. In the Add Connection window, make sure the MySQL Data Provider is being used and fill in all the information.

    To enter the port number, click and set the Port among the list of connection properties.

  4. Click to 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.

  5. Right-click the connection, select New MySQL Script, and then select the language of the editor (JavaScript or Python) to open a new MySQL script tab in Visual Studio.

To create a new editor for existing MySQL connections, you need only to do the last step.

Mysql Vs Code Extension

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.

Mysql For Visual Studio Code

Vscode Mysql Client

Visual

Mysql Connector Python Visual Studio Code

The third button is the button, 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.