Conexao mysql - erro ssl

PROCUREI POR POSTS PARECIDOS E ACHEI SOMENTE 1 SOBRE O PROBLEMA MAS EM LINUX, NO MEU CASO É WINDOWS10;

Minha conexao com mysql parece ter sucesso mas estou com o seguinte erro:

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.

Neste codigo:

package controle;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.*;

public class Database {

Connection con = null;
public Database()
{
try{
String url = “jdbc:mysql://127.0.0.1:3306/projetoclinica”;
String user = “root”;
String password = “pass”;

		Class dbDriver = Class.forName("com.mysql.jdbc.Driver");
		con = DriverManager.getConnection(url, user, password);
	}
	catch (Exception ex)
	{
		ex.printStackTrace();
	}
	finally
	{
		if (con != null)
		{
			try
			{
				con.close();
			}
			catch (Exception e){}
		}
	}

            }

}

tentei mudar para :

String url = “jdbc:mysql://127.0.0.1:3306/projetoclinica”+
"?verifyServerCertificate=false"+
"&useSSL=true"+
"&requireSSL=true";

mas deu um erro pior ainda, parece que nao consegue encontrar o ssl,

dei um show variables no MySQL>
mas aparece o ssl e openssl ‘disable’

como habilitar ele?

obrigado DESDE JA A TODOS!

Você importou o JAR no projeto e o banco é local?

package br.com.farmacia.factory;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConexaoFactory {
private static final String USUARIO = “root”;
private static final String SENHA = “”;
private static final String URL = “jdbc:mysql://localhost:3306/sistema?useTimezone=true&serverTimezone=UTC” ;

public static Connection conectar() throws SQLException{

//Referencia ao Driver mysql para versões antigas do java
DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver());

Connection conexao = DriverManager.getConnection(URL, USUARIO, SENHA);
return conexao;

}

public static void main(String[] args) {
try{
Connection conexao = ConexaoFactory.conectar();
System.out.println(“Conectado com sucesso!!”);
}

catch(SQLException ex){
	ex.printStackTrace();
	System.out.println("Conexão falhou!!");
}

}

}

ESTOU COM ESSE ERRO TAMBÉM AUGUEI PODE AJUDA GALERA

vamos ler a mensagem?

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

vejamos, vc PRECISA usar SSL na conexão com o banco?

Se vc não precisa, então vc pode fazer, por exemplo

jdbc:mysql://localhost:3306/sistema?useTimezone=true&serverTimezone=UTC&useSSL=false

simples assim.

2 curtidas

Já tentou defini o ssl para false, comigo funcionava. eu não lembro como faz pq tem tempo que fiz isso e perdi a classe de conexão, mas, na url define ssl para false.