SQL异常,用户’ronal’@’localhost’被拒绝访问(使用密码:是)。

huangapple go评论101阅读模式
英文:

SQLException Access denied for user 'ronal'@'localhost' (using password: YES)

问题

我正在尝试将数据库连接到应用程序。但是在应用程序属性中,我收到了访问被拒绝的错误。

这是我的applicationproperties文件:

spring.datasource.url=jdbc:mysql://localhost:3306/employeemanager
spring.datasource.username=ronal
spring.datasource.password=1234
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect

但是在错误消息中,它不是说'root'@'localhost',而是说'ronal'@'localhost'。ronal是我在这台计算机上的账户名。

我尝试连接到MySQL数据库,但是我收到了这个错误消息:"java.sql.SQLException: Access denied for user 'ronal'@'localhost' (using password: YES)"。

英文:

I am trying to connect database with application. Properties but I receive access denied error

here is my applicationproperties file:

spring.datasource.url=jdbc:mysql://localhost:3306/employeemanager
spring.datasource.name=root
spring.datasource.password=1234
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect

but on the error it is not saying 'root'@'localhost' it is saying 'ronal'@'localhost' ronal is my account name on this pc

I tried to connect with mysql database but I receive this error "java.sql.SQLException: Access denied for user 'ronal'@'localhost' (using password: YES)"

答案1

得分: 1

这是翻译好的部分:

It's `spring.datasource.username` not `spring.datasource.name`; change to

spring.datasource.username=root

And I think you also need

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
英文:

It's spring.datasource.username not spring.datasource.name; change to

spring.datasource.username=root

And I think you also need

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

huangapple
  • 本文由 发表于 2023年3月9日 21:42:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/75685406.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定