mysql 一个被误导的错误:
mysql jdbc连接,数据库ip变成了本地ip?
java.sql.SQLException: Access denied foruser 'btir'@'172.43.5.48' (using password: YES)
一个被误导的错误,看到这个错误时忘了可能是密码错了,因为这个东西是其他同事配置好的,所以没有多想,而且加上之前用过ssh登录命令,ssh的命令是这样格式的:
ssh -p 12333 root@216.230.230.114
没错,都有这种格式 user@ip,于是头脑昏了,以为数据库连错了,连到了本地ip(172.43.5.48,实际配置文件里面数据库并不在本地)。于是查框架代码,查半天,以为是哪里读配置文件错了,默认设成了本地ip,还对框架jar做了反编译。
浪费好多时间。
实际上这句报错的意思就是mysql连接密码错了:
Access denied for user 'btir'@'172.43.5.48' (using password: YES)
btir是你用的登录用户名,而@后面的ip就是登录时的ip,不是数据库所在的ip!
附上关于ssh命令的说明:
ssh命令用于远程登录上Linux主机。
常用格式:ssh [-l login_name] [-p port] [user@]hostname
@后面是你要登录的主机域名或ip,这一点与上面的报错信息不一样。
附上程序报错信息:
2016-07-13 22:38:02.623 ERRORbtir.dao.ha.SingleStmtPool:46 - java.sql.SQLException: Access denied for user'btir'@'172.43.5.48' (using password: YES)
atcom.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2975)
atcom.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:798)
atcom.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3700)
atcom.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1203)
atcom.mysql.jdbc.Connection.createNewIO(Connection.java:2568)
atcom.mysql.jdbc.Connection.<init>(Connection.java:1485)
atcom.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
atjava.sql.DriverManager.getConnection(DriverManager.java:582)
atjava.sql.DriverManager.getConnection(DriverManager.java:207)
atbtir.dao.ha.DBMgr.getMasterConn(DBMgr.java:168)
atbtir.dao.ha.SingleStmtPool.getConn(SingleStmtPool.java:52)
atbtir.dao.ha.SingleStmtPool.activateStmt(SingleStmtPool.java:37)
atbtir.dao.ha.SingleStmtPool.getStmt4Use(SingleStmtPool.java:114)
atbtir.dao.ha.StmtPool.borrowStmt(StmtPool.java:149)
atbtir.dao.ha.SingleStmtPool.borrow(SingleStmtPool.java:21)
atbtir.dao.ha.DBMgr.borrowSingleStmt(DBMgr.java:113)
atcom.eshore.base.dao.AbstractHADao.queryEntites(AbstractHADao.java:498)
atcom.eshore.bid.dao.impl.CommonDaoImpl.queryAllDmp(CommonDaoImpl.java:32)
atcom.eshore.bid.service.impl.DataInitServiceImpl.refreshDmpData(DataInitServiceImpl.java:37)
atcom.eshore.bid.listener.DataInitListener.onApplicationEvent(DataInitListener.java:38)
atcom.eshore.bid.listener.DataInitListener.onApplicationEvent(DataInitListener.java:1)
atorg.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
atorg.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
atorg.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948)
atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
atorg.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
atcom.caucho.server.webapp.WebApp.start(WebApp.java:1885)
atcom.caucho.server.deploy.DeployController.startImpl(DeployController.java:667)
atcom.caucho.server.deploy.DeployController.restartImpl(DeployController.java:630)
atcom.caucho.server.deploy.StartAutoRedeployAutoStrategy.alarm(StartAutoRedeployAutoStrategy.java:177)
atcom.caucho.server.deploy.DeployController.handleAlarm(DeployController.java:789)
atcom.caucho.util.Alarm.handleAlarm(Alarm.java:387)
atcom.caucho.util.Alarm.run(Alarm.java:357)
atcom.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:743)
atcom.caucho.util.ThreadPool$Item.run(ThreadPool.java:662)
atjava.lang.Thread.run(Thread.java:619)