小编rel*_*ari的帖子

警告:建议不要在没有服务器身份验证的情况下建立SSL连接

连接MySQL数据库时,我收到以下警告:

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

请帮我解决这个问题

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();
    }
}
}
Run Code Online (Sandbox Code Playgroud)

java mysql

20
推荐指数
1
解决办法
7万
查看次数

标签 统计

java ×1

mysql ×1