【问题标题】:SpringBoot truncates last two characters in connection urlSpringBoot 截断连接 url 中的最后两个字符
【发布时间】:2019-03-03 22:44:48
【问题描述】:

我收到以下错误。

java.sql.SQLException: Access denied for user 'aravind'@'192.168.99.1' (using password: YES)

但在我的 application.prpoerties 中,我指定了以下属性

spring.datasource.url=jdbc:mysql://192.168.99.100:3306
spring.datasource.username=aravind
spring.datasource.password=aravind
spring.datasource.name=zeus_spring
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
server.port=8090

Spring boot 删除了最后两个零,我不知道为什么。我有一个可以通过该 IP 访问的 docker 容器。

【问题讨论】:

  • 可能只是控制台日志的 ip 被截断了。它实际上不会尝试访问截断的 ip,因为否则它不会说访问被拒绝。由于日志显示拒绝访问,这意味着它正在尝试连接到正确的 IP。只是提供的凭据未通过身份验证。
  • 你能分别用这些凭据连接到mysql实例吗?

标签: mysql spring docker spring-boot


【解决方案1】:

使用以下属性并删除数据源名称应该可以工作。

spring.datasource.url=jdbc:mysql://192.168.99.100:3306/zeus_spring

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多