java运行报错,报错信息:You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide tr
解决办法:
找到配置文件,***.properties或者 其他配置数据库连接的地方
将
Connection conn = DriverManager.getConnection("jdbc:mysql:// jdbc:mysql://localhost:3306/test
改成
Connection conn = DriverManager.getConnection(“jdbc:mysql:// jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true”, "root ", “root”);
报错就会消失啦。
对错误说:


当遇到Java运行时由于SSL配置导致的MySQL连接错误,可以通过修改数据库连接配置来解决。在配置文件中,将数据库连接URL添加`useSSL=false`参数,例如:`jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true`。这将禁用SSL,从而消除报错。

3576

被折叠的 条评论
为什么被折叠?



