Connect to SingleStore using TLS/SSL
On this page
Enable SSL/TLS for a Connection
Most client connections are TLS/SSL-enabled by default, even if no parameters are specified.
-
Use a client side flag, such as
--ssl-mode=REQUIREDin the MySQL/SingleStore clients. -
Use a user created with
REQUIRE SSL, which enforces SSL on the server side.
Certificate-Based Authentication
You can provide a client certificate and client key while connecting using --ssl-cert and --ssl-key options.ssl_ engine variable.memsql..
The VERIFY_ option is not required to use TLS/SSL.
Refer to SSL Secure Connections for more information.
Refer to The SingleStore JDBC Driver for details on how to connect using JDBC.
Generate Client Certificates for SingleStore mTLS Connection
Create a client certificate/key pair signed by the CA, and use these files with SingleStore’s --ssl-cert and --ssl-key options for secure mutual TLS (mTLS) authentication.
The CA certificate (ca-cert.) must also be trusted by the SingleStore cluster configuration for client authentication.
Prerequisites
Install OpenSSL.
sudo apt-get install openssl -y
Create a Certificate Authority (CA)
If you already have a CA certificate from your organization or another trusted source, skip this step and use the existing CA to sign the client certificate.
-
Generate a CA private key:
openssl genrsa -out ca-key.pem 4096 -
Generate a CA certificate:
openssl req -x509 -new -nodes -key ca-key.pem -sha256 -days 3650 -out ca-cert.pem \-subj"/C=US/ST=CA/L=SanFrancisco/O=ExampleOrg/OU=IT/CN=Example-CA"
You now have:
-
ca-key.: The private key for your CA.pem -
ca-cert.: The public CA certificate.pem
Keep the CA key (ca-key.) private and secure.
Refer to Certificate-Based Authentication - step 1 for information on how to configure a CA for your cluster.
Create the Client Certificate and Key
-
Generate the client private key and certificate signing request (CSR) as follows:
openssl req -newkey rsa:2048 -nodes -keyout client-key.pem -out client-req.pem \-subj"/C=US/ST=CA/L=SanFrancisco/O=ExampleOrg/OU=Client/CN=client.example.com" -
Create a client certificate signed by the CA.
The following command uses the CA’s certificate and key to sign the client’s certificate. openssl x509 -req -in client-req.pem -CA ca-cert.pem -CAkey ca-key.pem \-CAcreateserial -out client-cert.pem -days 365 -sha256
You now have:
-
client-key.: Client private key.pem -
client-cert.: Client certificate signed by the CA.pem
Verify the Certificates
Run the following command to verify that the client certificate is properly signed by the CA:
openssl verify -CAfile ca-cert.pem client-cert.pem
An output similar to the following that the client certificate is properly signed by the CA:
client-cert.pem: OK
Use the Certificates
When connecting to SingleStore with mTLS, specify the client certificate and key.
mysql -u user \--ssl-ca=/path/to/ca.pem \--tls-version=TLSv1.2 \--ssl-cert=/path/to/client-cert.pem \--ssl-key=/path/to/client-key.pem
Ensure the SingleStore server is configured with server certificate and key before running this command.
Last modified: March 16, 2026