SpringBoot连接MySql报错:The server time zone value '�й���׼ʱ��' 和 Access denied for user ''@'localhost' (using password: NO)

错误提示:Access denied for user ''@'localhost' (using password: NO)

我遇到的原因是application.yml配置文件中,字段拼写错误。

解决办法:确认字段是否拼写错误,和账号密码是否正确!

例如我的配置文件正确格式如下:

spring:
  datasource:
      driver-class-name: com.mysql.jdbc.Driver
      url: jdbc:mysql://localhost:3306/blog
      username: root
      password: root

错误提示:The server time zone value '�й���׼ʱ��' 

MySql版本问题导致的时区报错,在配置文件中的Url后加上:serverTimezone=UTC

例如:

      url: jdbc:mysql://localhost:3306/blog?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC
原文地址:https://www.cnblogs.com/Bernard94/p/14181838.html