NutzCN Logo
问答 数据库密码有特殊字符,导致无法连接
发布于 2692天前 作者 qq_29ac5847 3066 次浏览 复制 上一个帖子 下一个帖子
标签:
2017-08-10 12:38:59,898 com.alibaba.druid.pool.DruidDataSource$CreateConnectionT
hread.run(DruidDataSource.java:2001) ERROR - create connection error, url: jdbc:
mysql://localhost:3306/kmaw, errorCode 1045, state 28000
java.sql.SQLException: Access denied for user 'root '@'localhost' (using passwor
d: YES)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:934)
        at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4104)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1299)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2338)
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2
371)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2163)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        at sun.reflect.GeneratedConstructorAccessor23.newInstance(Unknown Source
)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:378)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:305)
        at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterCha
inImpl.java:148)
        at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilte
r.java:211)
        at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterCha
inImpl.java:142)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnecti
on(DruidAbstractDataSource.java:1423)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnecti
on(DruidAbstractDataSource.java:1477)
        at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(Dru
idDataSource.java:1998)
2017-08-10 12:39:29,898 com.alibaba.druid.pool.DruidDataSource$CreateConnectionT
hread.run(DruidDataSource.java:2001) ERROR - create connection error, url: jdbc:
mysql://localhost:3306/kmaw, errorCode 1045, state 28000
java.sql.SQLException: Access denied for user 'root '@'localhost' (using passwor
d: YES)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:934)
        at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4104)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1299)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2338)
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2
371)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2163)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        at sun.reflect.GeneratedConstructorAccessor23.newInstance(Unknown Source
)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:378)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:305)
        at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterCha
inImpl.java:148)
        at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilte
r.java:211)
        at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterCha
inImpl.java:142)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnecti
on(DruidAbstractDataSource.java:1423)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnecti
on(DruidAbstractDataSource.java:1477)
        at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(Dru
idDataSource.java:1998)
2017-08-10 12:39:59,929 com.alibaba.druid.pool.DruidDataSource$CreateConnectionT
hread.run(DruidDataSource.java:2001) ERROR - create connection error, url: jdbc:
mysql://localhost:3306/kmaw, errorCode 1045, state 28000
java.sql.SQLException: Access denied for user 'root '@'localhost' (using passwor
d: YES)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:934)
        at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4104)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1299)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2338)
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2
371)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2163)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        at sun.reflect.GeneratedConstructorAccessor23.newInstance(Unknown Source
)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:378)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:305)
        at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterCha
inImpl.java:148)
        at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilte
r.java:211)
        at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterCha
inImpl.java:142)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnecti
on(DruidAbstractDataSource.java:1423)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnecti
on(DruidAbstractDataSource.java:1477)
        at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(Dru
idDataSource.java:1998)
2017-08-10 12:40:29,929 com.alibaba.druid.pool.DruidDataSource$CreateConnectionT
hread.run(DruidDataSource.java:2001) ERROR - create connection error, url: jdbc:
mysql://localhost:3306/kmaw, errorCode 1045, state 28000
java.sql.SQLException: Access denied for user 'root '@'localhost' (using passwor
d: YES)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:934)
        at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4104)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1299)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2338)
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2
371)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2163)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        at sun.reflect.GeneratedConstructorAccessor23.newInstance(Unknown Source
)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:378)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:305)
        at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterCha
inImpl.java:148)
        at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilte
r.java:211)
        at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterCha
inImpl.java:142)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnecti
on(DruidAbstractDataSource.java:1423)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnecti
on(DruidAbstractDataSource.java:1477)
        at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(Dru
idDataSource.java:1998)
2017-08-10 12:40:59,929 com.alibaba.druid.pool.DruidDataSource$CreateConnectionT
hread.run(DruidDataSource.java:2001) ERROR - create connection error, url: jdbc:
mysql://localhost:3306/kmaw, errorCode 1045, state 28000
java.sql.SQLException: Access denied for user 'root '@'localhost' (using passwor
d: YES)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:934)
        at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4104)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1299)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2338)
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2
371)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2163)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        at sun.reflect.GeneratedConstructorAccessor23.newInstance(Unknown Source
)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:378)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:305)
        at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterCha
inImpl.java:148)
        at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilte
r.java:211)
        at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterCha
inImpl.java:142)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnecti
on(DruidAbstractDataSource.java:1423)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnecti
on(DruidAbstractDataSource.java:1477)
        at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(Dru
idDataSource.java:1998)
2017-08-10 12:41:29,929 com.alibaba.druid.pool.DruidDataSource$CreateConnectionT
hread.run(DruidDataSource.java:2001) ERROR - create connection error, url: jdbc:
mysql://localhost:3306/kmaw, errorCode 1045, state 28000
java.sql.SQLException: Access denied for user 'root '@'localhost' (using passwor
d: YES)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:934)
        at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4104)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1299)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2338)
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2
371)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2163)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        at sun.reflect.GeneratedConstructorAccessor23.newInstance(Unknown Source
)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:378)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:305)
        at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterCha
inImpl.java:148)
        at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilte
r.java:211)
        at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterCha
inImpl.java:142)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnecti
on(DruidAbstractDataSource.java:1423)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnecti
on(DruidAbstractDataSource.java:1477)
        at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(Dru
idDataSource.java:1998)
2017-08-10 12:41:59,929 com.alibaba.druid.pool.DruidDataSource$CreateConnectionT
hread.run(DruidDataSource.java:2001) ERROR - create connection error, url: jdbc:
mysql://localhost:3306/kmaw, errorCode 1045, state 28000
java.sql.SQLException: Access denied for user 'root '@'localhost' (using passwor
d: YES)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:934)
        at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4104)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1299)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2338)
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2
371)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2163)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        at sun.reflect.GeneratedConstructorAccessor23.newInstance(Unknown Source
)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:378)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:305)
        at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterCha
inImpl.java:148)
        at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilte
r.java:211)
        at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterCha
inImpl.java:142)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnecti
on(DruidAbstractDataSource.java:1423)
        at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnecti
on(DruidAbstractDataSource.java:1477)
        at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(Dru
idDataSource.java:1998)

数据库连接配置如下:

db.url=jdbc:mysql://localhost:3306/kmaw 
db.username=root 
db.password=kmaw@0808#$
db.validationQuery=select 1
db.maxActive=100
7 回复

大神,请问怎么判断它有没有转义?

用记事本打开看

db.url=jdbc:mysql://localhost:3306/kmaw
db.username=root
db.password=kmaw@0808#$
db.validationQuery=select 1
db.maxActive=100

```

还是一样 没有转义

在Setup.init方法内, 把值取出来打印一下看看

public void init(NutConfig nc) {
    log.info("password = " + nc.getIoc().get(PropertiesProxy.class, "conf").get("db.password"))
}
添加回复
请先登陆
回到顶部