日期:2014-05-18  浏览次数:20703 次

jdbc连mysql问题
D:\Application\MySQL\bin>mysql -u root -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27
Server version: 5.0.67-community-nt MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

可见用户root,密码123456正常

Java code

String url="jdbc:mysql://127.0.0.1/lb?user=root&password=123456";
            conn = DriverManager.getConnection(url);


抛出异常:
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

------解决方案--------------------
呦~URL还可以这样写!
------解决方案--------------------
up
------解决方案--------------------


------解决方案--------------------
Java code

[color=#FF0000]//修改一下 [/color]
String url="jdbc:mysql://localhost/lb?user=root&password=123456";

------解决方案--------------------
同意楼上,换成3个参数的那个,要是还不行的话也有可能是驱动版本的问题