2018 10:47:27 ERROR com.alibaba.druid.pool.DruidDataSource - create connection error
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4190)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4122)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:927)
at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1709)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1252)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2486)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2519)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2304)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.GeneratedConstructorAccessor18.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1375)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1431)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:1844)
在其他电脑运行正常,导入后出现问题,不用框架连接数据库没问题,自己又建了一个新的项目也是SSM框架,结果也是这种问题,(即使数据库用户名不为root,它报错也是显示的Access denied for user 'root'@'localhost'),实在搞不懂,求大神指点
是不是没有设置本机访问权限之类的。
grant select,insert,update,execute on table.* to 'root'@'localhost' identified by 'password';
grant select,insert,update,execute on table.* to 'root'@'127.0.0.1' identified by 'password';
不用框架可以访问到数据库,用了框架就不行了,应该不是数据库的问题吧
@Abserver: 你试一下吧,你的报错信息就是你本机localhost访问被拒绝的。
是不是你服务器的mysql没有外部用户访问权限,或者防火墙的问题
eclipse的项目,本地的MySQL,不用框架能访问应该不是访问权限的问题吧
@Abserver: 那你查看一下你数据库链接配置,是不是不正确,你得druid连接池配置检查一下