使用SpringBoot做JAVA开发时,JDBC连接MySql数据库的时候遇到了报错:
ERROR 10392 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
WARN 10392 --- [ main] o.s.b.a.orm.jpa.DatabaseLookup : Unable to determine jdbc url from datasource
WARN 10392 --- [ main] o.h.e.j.e.i.JdbcEnvironmentInitiator : HHH000342: Could not obtain connection to query metadata : The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
1.首先检查了数据库账号密码是否正确:正确无误;
2.再检查数据库的访问权限: IP:%(所有人)的访问权限;
3.最后想到会不会是时区的问题,所以给application.yml文件中的datasource配置节中的url配置加上&serverTimezone=UTC(如下图),发现问题被解决。
这是原配置:
这是新配置: