【问题标题】:How to make Spring Boot to connect to SSL&Certificate Mysql Connection如何使 Spring Boot 连接到 SSL 证书 Mysql 连接
【发布时间】:2018-08-19 07:45:58
【问题描述】:

我有一个使用 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)

【问题讨论】:

    标签: mysql spring-boot


    【解决方案1】:

    How to configure spring boot application to use SSL/TLS over MySQL?

    此链接将回答您的问题。您可以传递 jdbc 查询参数,而不是 JVM 参数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-04-09
      • 2019-06-12
      • 2021-03-20
      • 1970-01-01
      • 1970-01-01
      • 2012-12-12
      • 2019-07-20
      • 2017-11-13
      相关资源
      最近更新 更多