警告:不建议在没有服务器身份验证的情况下建立SSL连接 [英] Warning: Establishing SSL connection without server's identity verification is not recommended

查看:878
本文介绍了警告:不建议在没有服务器身份验证的情况下建立SSL连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

连接MySQL数据库时,出现以下警告:

When connecting a MySQL database I get the warning below:

不建议在没有服务器身份验证的情况下建立SSL连接.根据MySQL 5.5.45 +,5.6.26 +和5.7.6+的要求,如果未设置显式选项,则默认情况下必须建立SSL连接.为了与不使用SSL的现有应用程序兼容,将verifyServerCertificate属性设置为'false'.您需要通过设置useSSL = false来显式禁用SSL,或者设置useSSL = true并为服务器证书验证提供信任库.

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.

请帮助我解决这个问题

import java.sql.*;
public class JdbcCreateTable {
public static void main(String args[])
{
    try
    {
        Class.forName("com.mysql.jdbc.Driver");
    }
    catch(ClassNotFoundException e)
    {
        e.printStackTrace();
    }
    try{
        Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/INTtech","root","root");
        Statement st=con.createStatement();
        int i=st.executeUpdate("create table Author(AID int primary key,Aname varchar(20),AContact no int,ACountry string)");
        System.out.println("Table is created"+i);
        con.close();
    }
    catch(SQLException e)
    {
        e.printStackTrace();
    }
}
}

推荐答案

将useSSL = false放在名称数据库的末尾:

Put the useSSL=false at the end of the name database:

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/INTtech?useSSL=false","root","root");

这篇关于警告:不建议在没有服务器身份验证的情况下建立SSL连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆