英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论