If the cluster is in a public subnet, you can connect to the nodes using a DNS address or an IP address from the public subnet.
We recommend connecting via a DNS address. The cluster uses the master discovery mechanism for DNS addresses: the address is bound to the node role rather than the node itself. If the master becomes unavailable, one of the replicas becomes the new master, and the address moves to the new node along with the role.
When connecting via an IP address from a public subnet, the master discovery mechanism is not used. If one of the replicas becomes the new master, the master's IP address will change, and the connection using the old IP address will stop working.
Connecting from a private subnet to a cluster in a private subnet
If you are connecting from a private subnet to a cluster in a private subnet, you can use a DNS address or a private IP address.
We recommend connecting via a DNS address. The cluster uses the master discovery mechanism for DNS addresses: the address is bound to the node role rather than the node itself. If the master becomes unavailable, one of the replicas becomes the new master, and the address moves to the new node along with the role.
When connecting via a private IP address, the master discovery mechanism is not used. If one of the replicas becomes the new master, the master's IP address will change, and the connection using the old IP address will stop working.
Connecting from the Internet to a cluster in a private subnet
If you connect to a cluster in a private subnet from the internet, you can only use a public floating IP address (Floating IP).
For public floating IP addresses (Floating IPs), the master discovery mechanism is used — the address is bound to the node's role, not to the node itself. If the master becomes unavailable, one of the replicas becomes the new master, and the address moves to the new node along with the role.
View the connection address
In the Control panel, in the top menu, click Products and select Cloud Databases.
Open the Active tab.
Go to the database cluster page → Connection tab.
In the Connection addresses block, check the address.
Number of connections
The number of connections for a MySQL sync cluster is determined by the amount of RAM for the database cluster nodes. 50 connections are available per 1 GB of RAM. For example, for a cluster with 4 GB of RAM, 200 connections are available, and for 6 GB of RAM, 300 connections.
To increase the number of connections, scale the cluster to the required amount of RAM.
Connect via SSL
Connecting using TLS (SSL) encryption ensures a secure connection between your server and the database cluster.
Bash
PowerShell
Python
PHP
Go
Node.js
Download the root certificate and place it in the ~/.mysql/ folder: