Home > database >  On Java eclipse to connect to the database in Java. SQL. SQLException
On Java eclipse to connect to the database in Java. SQL. SQLException

Time:10-03

The younger brother is just web use database in school, but when connecting to the database has been the exception
Java. SQL. SQLException: Access denied for user 'root' @ 'localhost' (using password: YES)
Try again the online methods,
Just for a test code
Class.forname (". Com. Mysql. JDBC Driver ");
The String url="JDBC: mysql://localhost: 3306/mydb";
String name="root";
String password="123456";

The Connection con=DriverManager. GetConnection (url, name, password);
System. The out. Println (con);
Package and guide the
Password must be right, should be have been changed several times
Database with navicat also can see
Database and reinstall had had the latest version to 5.5
The authority had been set, but the root permission to also have no reason to need to set up!


Now good collapse
As a beginner has been card can't go on really collapse

CodePudding user response:

The can't make a day

CodePudding user response:

In database command line
Grant all on *. * to root @ 'localhost' identified by '123456'.

CodePudding user response:

Class loading paths is correct?
  • Related