[Yandex Cloud documentation](../../index.md) > [Yandex Query](../index.md) > Step-by-step guides > Managing connections

# Managing connections

Yandex Query [connections](../concepts/glossary.md#connection) are necessary to access data sources and sinks.

## Creating a connection {#create}

To create a connection:

1. In the [management console](https://console.yandex.cloud), select the folder where you want to create a connection.
1. Navigate to **Yandex Query**.
1. In the left-hand panel, select **Connections**.
1. Click ![info](../../_assets/console-icons/plus.svg) **Create new**.
1. Specify the connection name and description. The naming requirements are as follows:

    * The name must consist of lowercase Latin letters.
    * It must be between 3 and 63 characters in length.
    * It may contain digits and hyphens.
    * It must start with a letter and cannot end with a hyphen.

1. Select the connection type and specify the **Connection type parameters**:

   {% list tabs %}

   - Object Storage

     * **Bucket auth**: `Public` or `Private`.
     * For a public bucket, specify a name in the **Bucket** field.
       For a private bucket:
       * Select **Cloud and Folder** where the data source is located.
       * Select an existing bucket or create a new one.
       * Select an existing or create a new [service account](../../iam/concepts/users/service-accounts.md). You will use it to access the data.

   - Data Streams

     * Select the **Cloud and Folder** where the data source is located.
     * Select or create a new [serverless Managed Service for YDB database](../../ydb/index.md) with a Yandex Data Streams [stream](../../data-streams/concepts/index.md).
     * Select an existing or create a new [service account](../../iam/concepts/users/service-accounts.md). You will use it to access the data.

   - Managed Service for ClickHouse®

      * **Cluster**: Select an existing Managed Service for ClickHouse® cluster or create a new one.
      * **Service account**: Select an existing Managed Service for ClickHouse® [service account](../../iam/concepts/users/service-accounts.md) or create a new one. Assign it the [`managed-clickhouse.viewer` role](../../managed-clickhouse/security.md#managed-clickhouse-viewer) allowing it to connect to `Managed Service for ClickHouse®` clusters.
      * **Database**: Select the database you will use when working with the ClickHouse® cluster.
      * **Login**: Username you will use to connect to ClickHouse® databases.
      * **Password**: Password you will use to connect to ClickHouse® databases.

   - Yandex MPP Analytics for PostgreSQL

      * **Cluster**: Select an existing Yandex MPP Analytics for PostgreSQL cluster or create a new one.
      * **Service account**: Select an existing Yandex MPP Analytics for PostgreSQL [service account](../../iam/concepts/users/service-accounts.md) or create a new one. Assign it the [`managed-greenplum.viewer` role](../../managed-greenplum/security/index.md#mgp-viewer) allowing it to connect to `Yandex MPP Analytics for PostgreSQL` clusters.
      * **Database**: Select the database you will use when working with the Greenplum® cluster.
      * **Schema**: Specify the [namespace](https://docs.vmware.com/en/VMware-Greenplum/7/greenplum-database/admin_guide-ddl-ddl-schema.html) you will use when working with the Greenplum® database.
      * **Login**: Username you will use to connect to Greenplum® databases.
      * **Password**: Password you will use to connect to Greenplum® databases.

   - Managed Service for MySQL®

      * **Cluster**: Select an existing Managed Service for MySQL® cluster or create a new one.
      * **Service account**: Select an existing Managed Service for MySQL® [service account](../../iam/concepts/users/service-accounts.md) or create a new one. Assign it the [`managed-mysql.viewer`](../../managed-mysql/security/index.md#managed-mysql-viewer) role allowing it to connect to `Managed Service for MySQL®` clusters.
      * **Database**: Select the database you will use when working with the MySQL® cluster.
      * **Login**: Username you will use to connect to MySQL® databases.
      * **Password**: Password you will use to connect to MySQL® databases.

   - Managed Service for PostgreSQL

      * **Cluster**: Select an existing Managed Service for PostgreSQL cluster or create a new one.
      * **Service account**: Select an existing Managed Service for PostgreSQL [service account](../../iam/concepts/users/service-accounts.md) or create a new one. Assign it the [`managed-postgresql.viewer` role](../../managed-postgresql/security/index.md#managed-postgresql-viewer) allowing it to connect to `Managed Service for PostgreSQL` clusters.
      * **Database**: Select the database you will use when working with the PostgreSQL cluster.
      * **Login**: Username you will use to connect to PostgreSQL databases.
      * **Password**: Password you will use to connect to PostgreSQL databases.

   - Managed Service for YDB
     
      * **Cluster**: Select an existing Managed Service for YDB database or create a new one.
      * **Service account**: Select the Managed Service for YDB [service account](../../iam/concepts/users/service-accounts.md) you will use for `Managed Service for YDB` cluster connections and database authentication.

   - Monitoring

     * Select the **Cloud and Folder** where the data source is located.
     * Select or create a new [service account](../../iam/concepts/users/service-accounts.md) that will be used for writing metrics.

   {% endlist %}

1. Click **Create**.

To use a connection with this service account, you need the `iam.serviceAccounts.user` [role](../../iam/security/index.md#iam-serviceAccounts-user).

Now, you can [create a binding](binding.md#create).

## Getting connection details {#get-info}

To view connection details:

1. In the [management console](https://console.yandex.cloud), select the folder where you have created the connection.
1. Navigate to **Yandex Query**.
1. In the left-hand panel, select **Connections**.
1. Find the connection you need in the list and click ![info](../../_assets/console-icons/circle-info.svg) in its row. The source and service account details will appear under **General**. The connection ID, creation timestamp, and creator will appear under **Meta**.

## Modifying connection settings {#update}

To edit connection settings:

1. In the [management console](https://console.yandex.cloud), select the folder where you have created the connection.
1. Navigate to **Yandex Query**.
1. In the left-hand panel, select **Connections**.
1. Find the connection you need in the list, click ![ellipsis](../../_assets/console-icons/ellipsis.svg) in its row, and select **Edit**.
1. Update the connection settings. Note that the connection type is read-only.
1. Click **Modify**.

## Deleting a connection {#delete}

To delete a connection:

1. In the [management console](https://console.yandex.cloud), select the folder where you have created the connection.
1. Navigate to **Yandex Query**.
1. In the left-hand panel, select **Connections**.
1. Find the connection you need in the list, click ![ellipsis](../../_assets/console-icons/ellipsis.svg) in its row, and select **Delete**.
1. Confirm connection deletion.

_ClickHouse® is a registered trademark of [ClickHouse, Inc](https://clickhouse.com)._