我有一个运行SSL +证书安全的远程Mysql服务器。我可以使用我自己的密钥库和truststore.jks使独立的Java JDBC连接正常工作。问题是,我找不到任何文档或网站,教我如何将使用SSL +证书保护的mysql数据库插入springboot。我的application.properties文件包含以下内容:
spring.jpa.database=MYSQL
spring.datasource.url=jdbc:mysql://{remote-ip}:3306/{database-name}?verifyServerCertificate=true&useSSL=true&requireSSL=true
spring.datasource.username=xxxxxxxx
spring.datasource.password=xxxxxx
spring.jpa.show-sql=true在Eclipse中,我在JVM-arguments字段下有:
-Djavax.net.ssl.trustStore="{path}\truststore.jks" -Djavax.net.ssl.trustStorePassword="xxxxx" -Djavax.net.debug=ssl
-Djavax..net.ssl.keyStore="{path}\keystore"
-Djavax.net.ssl.keyStorePassword="xxxxx"恐怕行不通。给我这个错误:
java.sql.SQLException: Access denied for user '{database-user}'@'{remote-ip}' (using password: YES)发布于 2018-10-08 21:53:35
How to configure spring boot application to use SSL/TLS over MySQL?
此链接将回答您的问题。您可以传递jdbc查询参数,而不是JVM参数。
https://stackoverflow.com/questions/49215755
复制相似问题