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

MYSQL数据库连接出错
前辈我是新手,我碰到问题,我个人认为是用户权限的问题,但我不知道如何设置,不是密码问题。在百度搜索也没找到合适我的解决办法。
我MYSQL是4.0.16版本JDK   1_4_2_03版本   tomcat5.0
MYSQL加裁了mysql-connectctor-java-3.0.9-stable-bin.jar至Tomcat\webapps\root\web-inf\lib  
但运行时提示:sqle=java.sql.SQLException:   Invalid   authorization   specification,   message   from   server:   "Access   denied   for   user:   'xiong@localhost '   (Using   password:   YES) "  

部分源程序如下:
Class.forName( "com.mysql.jdbc.Driver ").newInstance();
con   =   DriverManager.getConnection( "jdbc:mysql://localhost:3306/sample_db?user=xiong&password=xiong&useUnicode=true&characterEncoding=GB2312 ");
stmt   =   con.createStatement();



------解决方案--------------------
你用 xiong 能登录 数据库吗?

------解决方案--------------------
那就是你安装的时候没有设好,所以登不进去,
------解决方案--------------------
mysql的权限问题
你要先把xiong@localhost的权限设置好才能访问mysql