MySQLSyntaxErrorException:拒绝用户访问
MySQLSyntaxErrorException: Access denied for user
当我尝试从 Spring 引导应用程序连接到 MySQL 数据库时遇到问题。我的 application.yml 包含以下配置
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/wortschatz;
username: "bot"
password: "bot"
driver-class-name: com.mysql.jdbc.Driver
当我尝试使用用户 "bot" 时,出现错误“Access denied for user 'bot'@'127.0.0.1' to database 'wortschatz;'
”。同时,我可以使用 MySQL Workbench 登录和查询数据库。
最令人困惑的部分是我在我的 application.yml 中指定了 'root' 用户凭据并且它没有工作并出现错误“database 'wortschatz' not found
”
我想,我在 MySQL 方面遗漏了一些东西。但究竟是什么?权限似乎没问题(见下文)
只是 url: jdbc:mysql://127.0.0.1:3306/wortschatz;
中的一个愚蠢的拼写错误。配置字符串的末尾有多余的分号。应该只是 url: jdbc:mysql://127.0.0.1:3306/wortschatz
当我尝试从 Spring 引导应用程序连接到 MySQL 数据库时遇到问题。我的 application.yml 包含以下配置
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/wortschatz;
username: "bot"
password: "bot"
driver-class-name: com.mysql.jdbc.Driver
当我尝试使用用户 "bot" 时,出现错误“Access denied for user 'bot'@'127.0.0.1' to database 'wortschatz;'
”。同时,我可以使用 MySQL Workbench 登录和查询数据库。
最令人困惑的部分是我在我的 application.yml 中指定了 'root' 用户凭据并且它没有工作并出现错误“database 'wortschatz' not found
”
我想,我在 MySQL 方面遗漏了一些东西。但究竟是什么?权限似乎没问题(见下文)
只是 url: jdbc:mysql://127.0.0.1:3306/wortschatz;
中的一个愚蠢的拼写错误。配置字符串的末尾有多余的分号。应该只是 url: jdbc:mysql://127.0.0.1:3306/wortschatz