java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more

1.当启动报“java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.”时,请在application.yml数据库url后面添加?serverTimezone=GMT%2B8。如图:java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more

再次启动,问题解决。

2.关于application.yml说明:

当程序启动后,页面访问报500错误,如图1,后台报“org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.demo.dao.UserDao.getUser”,如图2,请检查application.yml配置,此时配置是错误的,如图3,正确的配置如图4

java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more

图1

java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more

图2

java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more

图3

java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more

出现这种问题的原因是因为yml文件是树状结构,去掉空格是不行的。yml文件key:后面都有一个空格而properties文件后面没有。注意:如果yml和properties文件都存在相同目录下,那么只执行properties文件。