首页 > 解决方案 > SpringBoot 截断连接 url 中的最后两个字符

问题描述

我收到以下错误。

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 容器。

标签: mysqlspringdockerspring-boot

解决方案


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

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

推荐阅读