用的是spring注解开发 原来是用户名username被系统名username覆盖了,Access denied for user 'XX'@'localhost' 把username换成user或自己找方法屏蔽系统名问题解决