Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Managed Service for MySQL®
  • Getting started
    • All guides
      • Pre-configuration
      • FQDNs of hosts
      • Connecting from applications
      • Code examples
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Command line tools
  • Linux (Bash)/macOS (Zsh)
  • Windows (PowerShell)
  • Connecting with IAM authentication
  • Connecting from graphical IDEs
  • Connecting from Yandex WebSQL
  • Before you connect from a Docker container
  1. Step-by-step guides
  2. Connection
  3. Connecting from applications

Connecting to an MySQL® cluster from applications

Written by
Yandex Cloud
Updated at February 13, 2026
  • Command line tools
    • Linux (Bash)/macOS (Zsh)
    • Windows (PowerShell)
    • Connecting with IAM authentication
  • Connecting from graphical IDEs
  • Connecting from Yandex WebSQL
  • Before you connect from a Docker container

This section provides settings for connection to Managed Service for MySQL® cluster hosts with the help of command line tools, graphical IDEs, Yandex WebSQL, or a Docker container. To learn how to connect from your application code, see Code examples.

Command line toolsCommand line tools

To see code examples with the host FQDN filled in, open the cluster page in the management console and click Connect.

Linux (Bash)/macOS (Zsh)Linux (Bash)/macOS (Zsh)

Before connecting, install the mysql utility:

sudo apt update && sudo apt install --yes mysql-client
Connecting with SSL
Connecting without SSL
mysql --host=<MySQL®_host_name>.mdb.yandexcloud.net \
      --port=3306 \
      --ssl-ca=~/.mysql/root.crt \
      --ssl-mode=VERIFY_IDENTITY \
      --user=<username> \
      --password \
      <DB_name>
mysql --host=<FQDN_of_any_MySQL®_host> \
      --port=3306 \
      --ssl-mode=DISABLED \
      --user=<username> \
      --password \
      <DB_name>

To learn how to get a host FQDN, see this guide.

When running any command, enter the database user password.

Once connected to the DBMS, run the SELECT version(); command.

If your cluster connection and test query are successful, you will see the MySQL® version.

Windows (PowerShell)Windows (PowerShell)

Before connecting, download and install MySQL Shell.

Connecting with SSL
Connecting without SSL
mysqlsh --host=<FQDN_of_any_MySQL®_host> `
        --port=3306 `
        --ssl-ca=<absolute_path_to_certificate_file> `
        --ssl-mode=VERIFY_IDENTITY `
        --user=<username> `
        --password `
        --database=<DB_name> `
        --sql
mysqlsh --host=<FQDN_of_any_MySQL®_host> `
        --port=3306 `
        --ssl-mode=DISABLED `
        --user=<username> `
        --password `
        --database=<DB_name>

To learn how to get a host FQDN, see this guide.

When running any command, enter the database user password.

Once connected to the DBMS, run the SELECT version(); command.

If your cluster connection and test query are successful, you will see the MySQL® version.

Connecting with IAM authenticationConnecting with IAM authentication

You can connect to a Managed Service for MySQL® database via the Yandex Cloud CLI using IAM authentication. This method is available to Yandex accounts, federated accounts, and local users. When connecting with IAM authentication, you do not need to obtain an SSL certificate or specify the cluster hosts’ FQDNs.

Before connecting, install the MySQL® client:

sudo apt update && sudo apt install --yes mysql-client

Set up your Managed Service for MySQL® cluster for connection:

Management console
  1. Navigate to the Managed Service for MySQL service.
  2. Click the name of your cluster.
  3. Enable public access for the cluster hosts:
    1. Select the Hosts tab.
    2. Click in the first host's row and select Edit.
    3. Enable Public access.
    4. Repeat the same for the remaining hosts in the cluster.
  4. Assign the following role to the service account of the user that will connect to the database:
    1. Select the Access bindings tab and click Assign roles.
    2. Enter the user's email the service account is associated with.
    3. Click Add role and select the managed-mysql.clusters.connector role.
    4. Click Save.
  5. Create a user named MySQL®:
    1. Select the Users tab.
    2. Click Create user.
    3. Select IAM as the authentication method.
    4. Select the account with the managed-mysql.clusters.connector role.
    5. Click Add database and select the database from the drop-down list.
    6. Click in the Roles column and select the privilege from the drop-down list.
    7. Click Create.

To connect to the Managed Service for MySQL® database, run this command:

yc managed-mysql connect <cluster_name_or_ID> --db <DB_name>

Connecting from graphical IDEsConnecting from graphical IDEs

Connections were tested in the following environment:

  • Ubuntu 20.04, DBeaver: 22.2.4
  • MacOS Monterey 12.7:
    • JetBrains DataGrip: 2023.3.4
    • DBeaver Community: 24.0.0

From graphical IDEs, you can only connect to public cluster hosts using an SSL certificate.

To avoid connection errors, save the certificate to a local folder that does not require administrator rights to access.

DataGrip
DBeaver
  1. Create a data source:
    1. Select File → New → Data Source → MySQL®.
    2. On the General tab:
      1. Configure the connection as follows:
        • Host: FQDN of any MySQL® host or a special FQDN.
        • Port: 3306.
        • User, Password: Database user name and password.
        • Database: Name of the database to connect to.
      2. Click Download to download the connection driver.
    3. On the SSH/SSL tab:
      1. Enable Use SSL.
      2. In the CA file field, specify the path to the SSL certificate file for your connection.
  2. Click Test Connection. If the connection is successful, you will see the connection status, DBMS information, and driver details.
  3. Click OK to save the data source.
  1. Create a new DB connection:
    1. In the Database menu, select New connection.
    2. Select MySQL® from the DB list.
    3. Click Next.
    4. Specify the connection settings on the Main tab:
      • Server host: FQDN of any MySQL® host or a special FQDN.
      • Port: 3306.
      • Database: Target database name.
      • Username, Password: Database user name and password.
    5. On the SSL tab:
      1. Enable Use SSL.
      2. In the CA certificate field, specify the path to the SSL certificate file you previously saved.
      3. Under Advanced:
        1. Enable Require SSL.
        2. Enable Verify server certificate.
  2. Click Test Connection .... If the connection is successful, you will see the connection status and information about the DBMS and driver.
  3. Click Done to save the database connection settings.

Connecting from Yandex WebSQLConnecting from Yandex WebSQL

You can use Yandex WebSQL to send SQL queries to Managed Service for MySQL® cluster databases.

WebSQL is a Yandex Cloud service that enables you to connect to managed database clusters, work with databases, tables, and schemas, and run queries. It is a web-based tool that requires no additional authorization and simplifies working with SQL commands by prompting the user.

To connect from WebSQL, activate the WebSQL access option in the cluster settings. You can enable it when creating or updating a cluster.

In the Managed Service for MySQL® cluster, a Connection Manager connection is automatically created for each database user, which you can use to connect to the database from WebSQL. If required, you can also create a new connection.

To connect to the database from WebSQL:

Management console
  1. In the management console, select the folder with the cluster you need.

  2. Go to Managed Service for MySQL.

  3. Click the cluster name and go to the WebSQL tab.

  4. Select the required connection.

    The connection will open in WebSQL. To go to the query editor, select the required database.

    Check this MySQL® reference for supported queries.

For more information on how to work with WebSQL, see these guides.

Before you connect from a Docker containerBefore you connect from a Docker container

To connect to a Managed Service for MySQL® cluster from a Docker container, add the following lines to the Dockerfile:

Connecting without SSL
Connecting with SSL
RUN apt-get update && \
    apt-get install mysql-client --yes
RUN apt-get update && \
    apt-get install wget mysql-client --yes && \
    mkdir --parents ~/.mysql && \
    wget "https://storage.yandexcloud.net/cloud-certs/CA.pem" \
         --output-document ~/.mysql/root.crt && \
    chmod 0600 ~/.mysql/root.crt

Was the article helpful?

Previous
FQDNs of hosts
Next
Code examples
© 2026 Direct Cursus Technology L.L.C.