Re: MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Posted by: willians nogueira
Date: December 01, 2018 11:05AM

Hi, Filipe.

Here is the java code without the concatenation ("?useTimezone=true&serverTimezone=UTC") and its error.
Note that user = root and password = root

******

public class Conectar {

static String bd = "";

static String user = "root";

static String password = "root";

static String url = "jdbc:mysql://localhost:3306/" + bd +"?useSSL=false";

Connection conn = null;

public Conectar(){

System.out.println(1);

try {

Class.forName("com.mysql.cj.jdbc.Driver");

conn=DriverManager.getConnection(url, user, password);

//conn=DriverManager.getConnection(url, user, password + "?useTimezone=true&serverTimezone=UTC");

if(conn!=null) {

System.out.println("Conenecting database ["+conn+"] OK");

}else {

System.out.println("Conenecting database ["+conn+"] _willians");

}

}catch (ClassNotFoundException e) {
System.out.println("Exception driver: "+ e.getMessage());
} catch (SQLException e) {
System.out.println("Exception connection: "+ e.getMessage());
e.printStackTrace();
}

}


Error :

Exception connection: The server time zone value 'Brazilian summer time' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

******



Next is the same code with the concatenation. No more the above exception but "Access denied" exception instead.

xxxxxxxxxxxx

public class Conectar {

static String bd = "";

static String user = "root";

static String password = "root";

static String url = "jdbc:mysql://localhost:3306/" + bd +"?useSSL=false";

Connection conn = null;

public Conectar(){

System.out.println(1);

try {

Class.forName("com.mysql.cj.jdbc.Driver");

//conn=DriverManager.getConnection(url, user, password);

conn=DriverManager.getConnection(url, user, password + "?useTimezone=true&serverTimezone=UTC");

if(conn!=null) {

System.out.println("Conenecting database ["+conn+"] OK");

}else {

System.out.println("Conenecting database ["+conn+"] _willians");

}

}catch (ClassNotFoundException e) {
System.out.println("Exception driver: "+ e.getMessage());
} catch (SQLException e) {
System.out.println("Exception connection: "+ e.getMessage());
e.printStackTrace();
}

}


Exception connection: Access denied for user 'root'@'localhost' (using password: YES)


xxxxxxxxxxxx

Options: ReplyQuote


Subject
Written By
Posted
Re: MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
December 01, 2018 11:05AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.