首页上一页 1 下一页尾页 1 条记录 1/1页
public class Conn {
public static void main(String[] args) {
try{
String mysql = "com.mysql.jdbc.Driver";
String dbms = "jdbc:mysql://127.0.0.1:3306/employee";
String userName = "root";
String Pwd = "mysql123";
Class.forName(mysql);
Connection conn = DriverManager.getConnection(dbms,userName,Pwd);
System.out.println(conn);
conn.close();
}catch(ClassNotFoundException e){
e.printStackTrace();
} catch (SQLException e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}
}
}
老是提示:java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
错误
我用navicat,或者cmd,运行都没问题