This is an almost 10-year-old question, but since there's no accepted answer I'd like to provide one.
Since you are also using java and what I assume to be mysql jdbc connector, if you have separate keystores (one for your JMX agent and one for Google Cloud Mysql server), you can let the JMX keystore use the default keystore settings via the java args (-Djavax.net.ssl.keyStore
, -Djavax.net.ssl.keyStoreType
, -Djavax.net.ssl.keyStorePassword
).
The Google Cloud Mysql server's keystore/truststore settings can then be configured in the jdbcurl connection string as such.
jdbc:mysql://your_mysql_server:3306/db_name?sslMode=REQUIRED&trustCertificateKeyStoreUrl=file:/path/to/your/truststore.jks&trustCertificateKeyStoreType=JKS&trustCertificateKeyStorePassword=changit&clientCertificateKeyStoreUrl=file:/path/to/your/keystore.jks&clientCertificateKeyStoreType=JKS&clientCertificateKeyStorePassword=changeit&enabledTLSProtocols=TLSv1.2
mysql-connector will prioritize the keystore/truststore specified in the jdbc url over the default -Djavax
ones, so this would allow you to use each keystore/truststore separately.
You can learn more about the parameters in the above jdbcurl connection string as well as others via section 6.3 Configuration Properties of the official mysql-connector/J documentation. The section regarding SSL/TLS related parameters is under 6.3.5 Security