lx0222xl

导航

初学mybatis和mysql碰到的问题

今天学习了下使用mybatis操作数据库,期间也是各种问题出现,幸好现在网络发达,网络上很多都可以解决,现在总结一下:

Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Client does not support authentication protocol requested by server; consider upgrading MySQL client
### The error may exist in com/luoxiang/mapping/userMapper.xml
### The error may involve com.luoxiang.mapping.userMapper.getUser
### The error occurred while executing a query
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Client does not support authentication protocol requested by server; consider upgrading MySQL client
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)
at com.luoxiang.instance.FiratMybatis.main(FiratMybatis.java:35)

原因:导入的mysql jar包版本与本身安装的mysql版本不一致,后面导入8.0.12版本的就ok了

 

posted on 2018-11-22 14:48  lx0222xl  阅读(275)  评论(0编辑  收藏  举报