JetBrains Rider 2023.3 Help

Connect to MySQL with named pipes

Enable the Database Tools and SQL plugin

This functionality relies on the Database Tools and SQL plugin, which is bundled and enabled in JetBrains Rider by default. If the relevant features aren't available, make sure that you didn't disable the plugin.

  1. Press Ctrl+Alt+S to open the IDE settings and then select Plugins.

  2. Open the Installed tab, find the Database Tools and SQL plugin, and select the checkbox next to the plugin name.

Named pipes provide a way for communication among processes that run on the same machine. By using named pipes, you can send your data without having the performance penalty that involves the network stack.

Just like you have a server that listens to an IP address and port for incoming requests, a server can also set up a named pipe that can listen for requests. In both cases, the client process must know the address or a pipe name to which it should send the request.

The default pipe name for the MySQL server is \\.\pipe\MySQL.

Prerequisites

Step 1. Enable named pipes for the MySQL server

Verify that named pipes are enabled

  • To ensure that named pipes are enabled, run the following code: SHOW GLOBAL VARIABLES LIKE 'named_pipe'.

    If the named_pipe variable has the ON value, skip Step 1.

    Verify that named pipes are enabled

Enable named pipes during server installation

  1. Run the installation wizard of the MySQL server.

  2. On the Type and Networking dialog, select the Named Pipe checkbox. You can change the pipe name or leave the default value.

  3. Finish all the steps of the installation wizard and start the MySQL server.

    Enable named pipes during server installation

Enable named pipes in my.ini

  1. Open the my.ini configuration file in a text editor.

  2. Add the enable-named-pipe parameter to the mysqld section. Consider the following example of the mysqld section:

    [mysqld] # The next three options are mutually exclusive to SERVER_PORT below. # skip-networking enable-named-pipe # shared-memory # shared-memory-base-name=MYSQL # The Pipe the MySQL Server will use socket=MYSQL
  3. Save changes and restart the MySQL server.

How to find my.ini and my.cnf?

  • In the command line, run mysql --help. Scroll down to the end of the Options section.

    List of options and default settings location in the command line

Step 2. Configure a connection in JetBrains Rider

  1. In the Database tool window ( View | Tool Windows | Database) , click the New icon New and select Connect to Database.

  2. If you have a connection string for the database defined in your solution or elsewhere, leave the Use connection string option selected and choose MySQL in the Database type selector.

    Use the String selector to choose the desired connection string from your solution or type it in manually, then click Connect.

  3. You can also choose Add data source manually, click Next and select MySQL in the Database source selector. Follow the wizard steps to form the connection string by configuring individual options.

  4. To access all available options for the new database connection, click in the Database window, then click the New icon New and select MySQL.

  5. Check if there is a Download missing driver files link at the bottom of the connection settings area. Click this link to download drivers that are required to interact with a database. For a direct download link, refer to the JetBrains JDBC drivers page.

    Location for the downloaded JDBC drivers is the JetBrains Rider configuration directory.

    The Download missing driver files link

    You can also use your drivers for the database instead of the provided ones. For more information about connecting to a database with your driver, refer to Add a user driver to an existing connection.

    If there is no Download missing driver files link, then you already have the required drivers.

  6. On the Advanced tab, find the serverTimezone parameter in the list of options. Double-click the Value cell and type your server timezone (for example, UTC).

  7. Click the General tab.

  8. In the Host field, type the following text: (protocol=pipe)(path=\\.\pipe\MySQL), where MySQL is the pipe name.

    Alternatively, in the Connection type list, select Unix Socket and type or select the path to the pipe: \\.\pipe\MySQL.

  9. Ensure that the connection to the database can be established using the provided details. To do that, click the Test Connection link at the bottom of the connection details area.

    Test Connection link

    In case of any connection issues, refer to the Cannot connect to a database page.

  10. (Optional) By default, only the default schema is introspected and available to work with. If you also want to work with other schemas, in the Schemas tab, select them for the introspection.

    Schemas tab of the Data Sources and Drivers dialog
  11. Click OK to create the data source.

  12. Find your new data source in the Database tool window (⌘ 1) .

    • For more information about the Database tool window, see the corresponding reference topic.

    • For more information about working with database objects in JetBrains Rider, refer to Database objects.

    • To write and run queries, open the default query console by clicking the data source and pressing F4.

    • To view and edit data of a database object, open Data editor and viewer by double-clicking the object.

Integration with MySQL
Last modified: 21 March 2024