[Yandex Cloud documentation](../index.md) > [Yandex Managed Service for MySQL®](index.md) > Getting started

# Getting started with Managed Service for MySQL®

To get started:


* [Create a database cluster](#cluster-create).
* [Connect to the database](#connect).



## Getting started {#before-you-begin}

1. Navigate to the [management console](https://console.yandex.cloud) and log in to Yandex Cloud or sign up if not signed up yet.
1. If you do not have a [folder](../resource-manager/concepts/resources-hierarchy.md#folder) yet, create one:

   1. In the [management console](https://console.yandex.cloud), in the top panel, click ![image](../_assets/console-icons/layout-side-content-left.svg) or ![image](../_assets/console-icons/chevron-down.svg) and select the [cloud](../resource-manager/concepts/resources-hierarchy.md#cloud).
   1. To the right of the cloud name, click ![image](../_assets/console-icons/ellipsis.svg).
   1. Select ![image](../_assets/console-icons/plus.svg) **Create folder**.
   
      ![create-folder1](../_assets/resource-manager/create-folder-1.png)
   
   1. Give your [folder](../resource-manager/concepts/resources-hierarchy.md#folder) a name. The naming requirements are as follows:
   
       * Length: between 3 and 63 characters.
       * It can only contain lowercase Latin letters, numbers, and hyphens.
       * It must start with a letter and cannot end with a hyphen.
   
   1. Optionally, specify the description for your folder.
   1. Select **Create a default network**. This will create a [network](../vpc/concepts/network.md#network) with subnets in each availability zone. Within this network, you will also have a [default security group](../vpc/concepts/security-groups.md#default-security-group), within which all network traffic will be allowed.
   1. Click **Create**.
   
      ![create-folder2](../_assets/resource-manager/create-folder-2.png)

1. [Assign](../iam/operations/roles/grant.md) the [vpc.user](../vpc/security/index.md#vpc-user) role and the [managed-mysql.editor role or higher](security/index.md#roles-list) to your Yandex Cloud account. These roles allow you to create a cluster.

    {% note info %}
    
    If you cannot manage roles, contact your cloud or organization administrator.
    
    {% endnote %}

1. You can connect to database [clusters](concepts/index.md) from both inside and outside Yandex Cloud:
   * To connect from inside Yandex Cloud, create a [VM](../compute/concepts/vm.md) in the same [cloud network](../vpc/concepts/network.md#network) as the database cluster (on [Linux](../compute/quickstart/quick-create-linux.md)).
   * To connect to the Managed Service for MySQL® cluster from the internet, request public access to hosts when creating the cluster.

   {% note info %}

   The next step assumes that you are connecting to the Managed Service for MySQL® cluster from a [Linux](../compute/quickstart/quick-create-linux.md) VM.

   {% endnote %}

1. [Connect](../compute/operations/vm-connect/ssh.md) to your VM over SSH.
1. Install the required dependencies and the MySQL® client:

   ```bash
   sudo apt update && sudo apt install -y mysql-client
   ```


## Create a cluster {#cluster-create}

1. In the management console, select the folder where you want to create your database cluster.
1. Navigate to **Managed Service for&nbsp;MySQL**.
1. Click **Create cluster**.
1. Specify your Managed Service for MySQL® cluster settings and click **Create cluster**. For more information, see [Creating a cluster](operations/cluster-create.md).
1. Wait until the Managed Service for MySQL® cluster is ready: its status on the Managed Service for MySQL® dashboard will change to **Running** and its state, to **Alive**. This may take a while.


## Connect to the database {#connect}

1. If you are using [security groups](../vpc/concepts/security-groups.md) for a cloud network, [configure them](operations/connect/index.md#configure-security-groups) to allow all relevant traffic between the Managed Service for MySQL® cluster and the connecting host.

1. To connect to the database server, get an SSL certificate:

   {% list tabs group=operating_system %}
   
   - Linux (Bash)/macOS (Zsh) {#linux-macos}
   
      ```bash
      mkdir -p ~/.mysql && \
      wget "https://storage.yandexcloud.net/cloud-certs/CA.pem" \
           --output-document ~/.mysql/root.crt && \
      chmod 0600 ~/.mysql/root.crt
      ```
   
      The certificate will be saved to the `~/.mysql/root.crt` file.
   
   - Windows (PowerShell) {#windows}
   
      ```powershell
      mkdir $HOME\.mysql; curl.exe -o $HOME\.mysql\root.crt https://storage.yandexcloud.net/cloud-certs/CA.pem
      ```
   
      The certificate will be saved to the `$HOME\.mysql\root.crt` file.
   
      Your corporate security policies and antivirus software may block the certificate download. For more information, see [FAQ](qa/connection.md#get-ssl-error).
   
   {% endlist %}

1. Use the `mysql` command to connect:

   ```bash
   mysql --host=<MySQL®_host_name>.mdb.yandexcloud.net \
         --port=3306 \
         --ssl-ca=~/.mysql/root.crt \
         --ssl-mode=VERIFY_IDENTITY \
         --user=<username> \
         --password \
         <DB_name>
   ```


## What's next {#whats-next}

* Read about the [service concepts](concepts/index.md).
* Learn more about [creating a Managed Service for MySQL® cluster](operations/cluster-create.md) and [connecting to a database](operations/connect/index.md).
* Check out the [questions and answers](qa/general.md).