Creating a MySQL data service#
This tutorial creates an Ametnes-managed MySQL database — a private data
service you reach over an Ametnes network access endpoint. Both
service/mysql:9.4 and service/mysql:8.0 encrypt client connections with
TLS by default; only service/mysql:9.4 uses an Ametnes-CA certificate, so
only there can clients verify the server identity (see the warning below).
Prerequisites#
- A service location (see Service Location).
Networking is automatic by default
Creating a network access resource is optional. If you do not create one, Ametnes manages network access for the location — a shared load balancer publishes the endpoints for the services deployed there — and the service attaches automatically. Create your own only if you want to control exposure (see Network Access Resources).
Create the MySQL service#
Select the kind (service/mysql:<version>), tier, storage and node count.
Ametnes offers MySQL 9.4 and 8.0.
MySQL 8.0 TLS is encrypted but not verifiable
service/mysql:8.0 runs an older chart that has no managed
certificate, so the control plane issues it none. mysqld 8.0.28+ then
auto-generates a self-signed certificate and serves TLS anyway, so a
default client (--ssl-mode=PREFERRED) still gets an encrypted
session. That certificate is not signed by the Ametnes CA and does not
match the service hostname, so --ssl-mode=VERIFY_CA and
VERIFY_IDENTITY fail against 8.0. Use service/mysql:9.4 when you
need a verifiable, Ametnes-CA-signed server certificate.
- Navigate to the Services left menu and click New Service.
- Enter Name:
MysqlService. - Select Kind: MySql 9.4 Service.
- Select the Location: your data service location. Leave Network unset to let Ametnes manage it.
- Select the Setup Architecture (for example Basic for evaluation, or Large and above for production).
- Set the Admin Password for the
rootuser; a password is generated when omitted. - Click Create Service and wait for the status
ready.
Connect#
Use the connections returned by the service (or the console's connection
panel). MySQL listens on port 3306; the host is the service's DNS name on
your zone. The admin user is root; the application user is ametnes (with
database ametnes).
A default mysql client negotiates TLS automatically: the server certificate
is issued by the Ametnes CA, and only the CA certificate is distributed to
the service (never the CA private key). Confirm the session is encrypted:
mysql> SHOW SESSION STATUS LIKE 'Ssl_cipher';
+---------------+------------------------+
| Variable_name | Value |
+---------------+------------------------+
| Ssl_cipher | TLS_AES_128_GCM_SHA256 |
+---------------+------------------------+
1 row in set (0.00 sec)
An empty Ssl_cipher means the connection is not encrypted.
Notes#
- On
service/mysql:9.4TLS is enabled by default and clients default to--ssl-mode=PREFERRED, so encryption is negotiated without extra flags. The server does not reject plaintext, so a client that explicitly disables TLS (--ssl-mode=DISABLED) still connects unencrypted. To require certificate verification, connect with--ssl-mode=VERIFY_CAand the published CA certificate. - MySQL 8.0 also encrypts by default, but with a self-signed,
per-instance certificate that mysqld generates itself, so
--ssl-mode=VERIFY_CA/VERIFY_IDENTITYfail there. See the warning above.
Next#
- Service Location — choose where the service runs.
- Network Access Resources — control how the service is exposed.