spring jpa application.properties useSSL

前端 未结 3 670
逝去的感伤
逝去的感伤 2020-12-15 05:30

I am trying to turn off ssl, to my local mysql database. But I cannot find the actual property in a spring application.properties file that would do this.

my current

相关标签:
3条回答
  • 2020-12-15 06:10

    I fixed my issue with the below:

    jdbc:mysql://localhost:3306/test?verifyServerCertificate=false&useSSL=false&requireSSL=false
    
    0 讨论(0)
  • 2020-12-15 06:14

    Shouldn't you be using '?' instead of '&'

    This is yours

    spring.datasource.url =jdbc:mysql://localhost:3306/test&useSSL=false
    

    What I'm saying is

    spring.datasource.url = jdbc:mysql://localhost:3306/test?useSSL=false
    
    0 讨论(0)
  • 2020-12-15 06:27

    I don't like to pollute java options or system properties, which are useless in application containers in any case...

    You can set SSL certificate for MySQL connection programmically with:

    jdbc:mysql://example.com:3306/MYDB?verifyServerCertificate=true&useSSL=true&requireSSL=true&clientCertificateKeyStoreUrl=file:cert/keystore.jks&clientCertificateKeyStorePassword=123456&trustCertificateKeyStoreUrl=file:cert/truststore.jks&trustCertificateKeyStorePassword=123456

    It is documented:

    • https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html
    • https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-using-ssl.html
    0 讨论(0)
提交回复
热议问题