mysql8连接jdbc踩坑实录

1、maven里mysql-connector-java要及时更新,最好改成和mysql一样的版本


2、记得将eclipse的编码方式和mysql的编码方式统一为utf8,不然就会是utf8mb4这种东西。


3、老生常谈的  “Client does not support authentication protocol requested by server;”

mysql8的改法是——

输入ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';(root是用户名,localhost是ip地址127.0.0.1都是特指本机,mysql_native_password是旧的密码验证机制,root是密码,最后别忘了分号;)

另外,my.ini里也要改成

default_authentication_plugin=mysql_native_password

(可能不必要,反正我两个都改了)


4、 少见的    The server time zone value 'Öйú±ê׼ʱ¼ä'   错误,借鉴了

https://blog.csdn.net/xiaoweiba_h/article/details/80055440的方法


猜你喜欢

转载自blog.csdn.net/leokingszx/article/details/80303570