一、在进行JDBC数据库连接时报错:The server time zone value ‘Öйú±ê׼ʱ¼ä’ is unrecognized or represents more than one。
这是mysql的时区错误,解决
- 启动数据库:(以管理员的身份)
net start mysql
- 登录mysql:
mysql -uroot -p
提示输入密码:
输入即可;
3. show variables like '%time_zone%';
4. set global time_zone='+8:00';
5. 可以再检测一下
show variables like '%time_zone%';
第二种方法,在代码中的:为URL添加参数?serverTimezone=UTC即可
二、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’
解决方法:将数据库驱动com.mysql.jdbc.Driver’改为com.mysql.cj.jdbc.Driver即可;