java 连接 Mysql数据库,配置信息错误

    技术2022-07-13  67

    IDEA报错 ERROR 18800 --- [ task-1] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.

    提示 Loading class 'com.mysql.jdbc.Driver'. This is deprecated. The new driver class is 'com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. 应该将'com.mysql.jdbc.Driver'替换为新的驱动类'com.mysql.cj.jdbc.Driver'

    java.sql.SQLException: 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.

    Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: 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. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 这里提示zone vlause 乱码 那么修改url设置如下 url = jdbc:mysql://localhost:3306/examonline?serverTimezone=UTC&useSSL=false

    最后的配置就是

    driverClass = com.mysql.cj.jdbc.Driver url = jdbc:mysql://localhost:3306/examonline?serverTimezone=UTC&useSSL=false

    springboot启动成功

    Processed: 0.011, SQL: 9