Loading

How to connect to MySQL using SSL

Veröffentlichungsdatum: Aug 5, 2025
Schritte
GOAL
 
This knowledge article gives samples on how to connect to MySQL using SSL by using JDBC properties instead of modifying system properties.

PROCEDURE

The following JDBC properties need to be set:
  • useSSL: set to true
  • requireSSL:  set to true
  • trustCertificateKeyStoreUrl: set to your local trust keystore path
  • trustCertificateKeyStorePassword: set to your local trust keystore password
  • clientCertificateKeyStoreUrl: set to your local keystore path
  • clientCertificateKeyStorePassword: set to your local keystore password
Please see the examples below:

Mule 3:
<db:mysql-config name="MySQL_Configuration" 
url="jdbc:mysql://${db.host}:${db..port}/${db.database}?password=${db.password}&amp;user=${db.user}&amp;useSSL=true&amp;requireSSL=true&amp;trustCertificateKeyStoreUrl=file://${trustStorePath}&amp;trustCertificateKeyStorePassword=${trustStorePassword}&amp;clientCertificateKeyStoreUrl=file://${keyStorePath}&amp;clientCertificateKeyStorePassword=${keyStorePassword}" 
doc:name="MySQL Configuration" />
Mule 4:
<db:config name="MySQL_Configuration" doc:name="MySQL Configuration" doc:id="249c41bc-c65d-4c6a-a858-94e7ed63ae97" >
	<db:my-sql-connection host="${db.host}" port="${db..port}" user="${db.user}" password="${db.password}" database="${db.database}" >
		<db:connection-properties >
			<db:connection-property key="useSSL" value="true" />
			<db:connection-property key="requireSSL" value="true" />
			<db:connection-property key="trustCertificateKeyStoreUrl" value="file://${trustStorePath}" />
			<db:connection-property key="trustCertificateKeyStorePassword" value="${trustStorePassword}" />
			<db:connection-property key="clientCertificateKeyStoreUrl" value="file://${keyStorePath}" />
			<db:connection-property key="clientCertificateKeyStorePassword" value="${keyStorePassword}" />
		</db:connection-properties>
	</db:my-sql-connection>
</db:config>

Tips:
1. -Djavax.net.debug=SSL can be used to diagnose SSL handshake.
2. If you get "Communications link failure" during application deployment, refer to Cannot get connection for URL of MySQL DB: Communications link failure.

REFERENCE
Nummer des Knowledge-Artikels

001114828

 
Laden
Salesforce Help | Article