原因是:安装MySQL 8过程中的Authentication Method这一配置过程,基于不同的加密方式。1
2
3
4
5
6
7
8// 登录MySQL
mysql -u root -p
// 更改加密方式 (666666为mMySQL密码)
ALTER USER 'root'@'localhost' IDENTIFIED BY '666666' PASSWORD EXPIRE NEVER;
// 更改密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '666666';
// 重启MySQL
mysql.server restart
2.常见问题
2.1 MySQL 8 driver为:com.mysql.cj.jdbc.Driver
1 | 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 |
2.2 url中没有设置useSSL=false
1 | WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements <br>SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate<br> property is set to 'false'.You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate<br> verification. |
2.3 url中没有设置serverTimezone=UTC
1 | 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 |
2.4 url中参数没有用;拼接 & -> &
1 | The reference to entity “useSSL” must end with the ‘;’ delimiter. |
3. MySQL 8 连接配置
1 | <property name="driver" value="com.mysql.cj.jdbc.Driver"/> |