Connecting to a MySQL cluster
How do I connect to a cluster?
View the connection examples in the documentation or on the cluster page in the management console
MySQL hosts with public access only support connections with an SSL certificate.
There are also Special FQDNs pointing to the current master and the most recent replica (the one most up-to-date with the master) in the cluster.
Why can't I connect from the internet?
Check whether there is public access to the host. To do this, in the management console
- Go to the folder page and select Managed Service for MySQL.
- Click the cluster name and select the Hosts tab.
- Look at the value in the specific host's Public access column.
MySQL hosts with public access only support connections with an SSL certificate.
Additional information:
- If public access is only configured for certain hosts in your cluster, automatic master change may make the master unavailable over the internet.
- If you are using Special FQDNs, check the host list to see that the current master or replica have public access.
- If you are using Security groups, please check their settings.
Why can't I connect from Yandex Cloud?
Please check that you are connecting from a Yandex Cloud VM located on the same virtual network as the MySQL cluster.
To do this, in the management console:
- Go to the folder page, select Managed Service for MySQL, and click the name of the specific cluster.
- Check the value of the Cloud network parameter and click the network name link to see its subnets.
- Make sure the virtual machine is located on one of the network's subnets.
Additional information:
- If you are connecting to a host with public access, a connection can only be established with an SSL certificate.
- If you are using Special FQDNs, check the host list to see that the current master or replica have public access.
- If you are using Security groups, please check their settings.
Why can't I connect to a multi-host cluster?
If public access is only configured for certain hosts in your cluster, automatic master change may make the master unavailable over the internet.
Check whether there is public access to the host. To do this, in the management console
- Go to the folder page and select Managed Service for MySQL.
- Click the cluster name and select the Hosts tab.
- Look at the value in the specific host's Public access column.
Additional information:
-
If you are using Special FQDNs, check the host list to see that the current master or replica have public access.
-
If you cannot connect to the added host, check that the cluster security group is configured correctly for the subnet where you placed the host.
Why would the connection limit be exceeded?
The maximum number of concurrent connections to a Managed Service for MySQL cluster host depends on max_connections
and is <MB_of_RAM_per_host> ÷ 32
by default, but not less than 100.
For example, for a host of the s1.micro (2 vCPU, 8 GB) class, the default max_connections
parameter value is: 8192 ÷ 32 = 256.
You can edit the Max connections value in the cluster settings.