使用 mysql 驱动程序设置带有 mysql 数据库的 spring-boot 项目

Rak*_* .p 5 java mysql spring-boot

MySQL 连接器是 maven 依赖项的一部分,所有数据库属性如 url、用户名、密码都在 application.properties 中提到。

获取 RuntimeException,例如:

驱动com.mysql.jdbc.Driver声称不接受jdbcUrl,jdbc/mysql://10.53.235.141:3306/hms。

请帮助解决。

application.properties

 spring.datasource.url=jdbc/mysql://10.53.235.141:3306/hms
 spring.datasource.username="root"
 spring.datasource.password="password"
 spring.datasource.driverClassName=com.mysql.jdbc.Driver
 spring.jpa.database = MYSQL

[![Project setup structure][1]][1]
Run Code Online (Sandbox Code Playgroud)

控制台异常

小智 6

URL 格式错误,请使用以下 URL

spring.datasource.url=jdbc:mysql://10.53.235.141:3306/hms

代替

spring.datasource.url=jdbc/mysql://10.53.235.141:3306/hms
Run Code Online (Sandbox Code Playgroud)


Shu*_*ubh 1

你的网址错误,请使用这个

jdbc:mysql://10.53.235.141:3306/hms"
Run Code Online (Sandbox Code Playgroud)