MySQL异常:

Fri Jun 01 22:43:01 CST 2018 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 SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate 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 verification.

这是警告,并非异常,不影响正常使用,原因是已经建立SSL连接,但是没有进行数据库身份验证,不建议这样使用。

源代码:

con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test",

     "root","123456");

解决方案:

con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false", "root","123456");

MySQL8.0报错:caching-sha2-password.

这个是8.0的新特性,意思是无法加载身份验证插件。

解决方案:MySQL控制台输入,

       ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; // 修改加密规则

       ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; // 更新一下用户的密码 

       FLUSH PRIVILEGES; // 刷新权限

       再重置密码:ALTER user 'root'@'localhost' IDENTIFIED BY '123456';

解决成功!

猜你喜欢

转载自blog.csdn.net/Wuli9468/article/details/80543697