将MySQL升级到8.0.x后的遇到到错误及解决

一,安装的时遇到的坑

我下的是Mysql 8.0.13
下的是解压版(个人能不用安装就不想用安装版的强迫症(/▽\))
然后问题就来了:
解压后还要初始化,命令是:
mysqld --initialize --user=mysql --console
然后我就一直会有错误,导致初始化出问题。
配置好环境变量,然后用cmd管理员权限才成功(没成功的话可能就是没用管理员权限)
初始化出来的临时密码要记起来,最好就安装完及改掉,要不然就麻烦。

二,eclipse中启动项目时出错

①第一个Error:MySQLNonTransientConnectionException

MySQLNonTransientConnectionException:
Client does not support authentication protocol requested by server; consider upgrading MySQL client

错误原因:MySQL的驱动不支持了

解决:下载最新的适合的驱动;

下载链接:https://dev.mysql.com/downloads/connector/j/

 

选择平台独立,然后下载。

②第二个Error:Loading class…

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’。

解决:将驱动的代码改为新的,我做的一个是SSH的 ,将jdbc.properties中的

jdbc.driver = com.mysql.jdbc.Driver
改为==>
jdbc.driver = com.mysql.cj.jdbc.Driver

③第三个Error:The server time zone value ‘Öйú±ê׼ʱ¼ä’ is unrecognized

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.

错误原因:它说时区不能识别,需要指定时区

解决:在uri链接上加上时区的参数指定时区。

jdbc.url = jdbc:mysql:///artexam?serverTimezone=UTC

④第四个Error:Public Key Retrieval is not allowed

当我重启数据库的时候,再次启动项目就报了这个错:

Public Key Retrieval is not allowed

解决:在参数上给它带上允许

jdbc.url = jdbc:mysql:///manxc?serverTimezone=UTC&allowPublicKeyRetrieval=true
原文地址:https://www.cnblogs.com/flytree/p/11390566.html