英文:
Access denied for user 'hp'@'localhost' (using password: NO) in SpringBoot application
问题
尝试使用我的SpringBoot应用连接MySQL服务器时遇到上述问题,请有人能提供建议吗?
spring.datasource.url=jdbc:mysql://localhost:3306/myblog
spring.datasource.username=Admin
spring.datasource.password=Admin
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
spring.jpa.hibernate.ddl-auto=update
错误如下:
java.sql.SQLException: 用户 'hp'@'localhost' 拒绝访问(使用密码:NO)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:130) ~[mysql-connector-j-8.0.33.jar:8.0.33]
// 其他错误信息...
英文:
Trying to connect with MySQL server with my SpringBoot application but facing above issue, can someone suggest?
spring.datasource.url=jdbc:mysql://localhost:3306/myblog
spring.datasourse.username=Admin
spring.datasourse.password=Admin
spring.jpa.properties.hibernate.dailect=org.hibernate.dialect.MySQLDialect
spring.jpa.hibernate.ddl-auto=update
Error as per below
java.sql.SQLException: Access denied for user 'hp'@'localhost' (using password: NO)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:130) ~[mysql-connector-j-8.0.33.jar:8.0.33]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-j-8.0.33.jar:8.0.33]
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825) ~[mysql-connector-j-8.0.33.jar:8.0.33]
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:446) ~[mysql-connector-j-8.0.33.jar:8.0.33]
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:239) ~[mysql-connector-j-8.0.33.jar:8.0.33]
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:188) ~[mysql-connector-j-8.0.33.jar:8.0.33]
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:121) ~[HikariCP-5.0.1.jar:na]
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359) ~[HikariCP-5.0.1.jar:na]
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201) ~[HikariCP-5.0.1.jar:na]
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470) ~[HikariCP-5.0.1.jar:na]
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) ~[HikariCP-5.0.1.jar:na]
at co
答案1
得分: 1
错误提示显示用户“hp”,但您的属性显示用户“Admin”。另外,密码不匹配。您的应用程序正在使用错误的凭据。对于安全性来说,两个密码的质量都非常糟糕是另一个问题。
英文:
The error says user "hp" but your properties say user "Admin". Also the password doesn't match. Your applications is using the wrong credentials. That both passwords have very bad quality for security is a different issue.
答案2
得分: 0
请检查数据源的拼写错误:
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/db?createDatabaseIfNotExist=true
spring.datasource.username=root //your db user name
spring.datasource.password=root //your db user password
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
#如果您的 MySql 版本是 5,请使用 MySQL5Dialect
spring.data.jpa.repositories.enabled=true
spring.jpa.show-sql=true
spring.jpa.database=mysql
英文:
Kindly check the spelling mistake of datasource:
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/db?createDatabaseIfNotExist=true
spring.datasource.username=root //your db user name
spring.datasource.password=root //your db user password
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
#If your MySql version 5 then use MySQL5Dialect
spring.data.jpa.repositories.enabled=true
spring.jpa.show-sql=true
spring.jpa.database=mysql
答案3
得分: 0
数据源 -> 数据源
方言 -> 方言
英文:
Typo alert!!
datasourse -> datasource
dailect -> dialect
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论