Access denied for user 'Administrator'@'localhost' (using password: YES)

Access denied for user 'Administrator'@'localhost' (using password: YES)

配置文件中明明是用的root

<entry key="url"><![CDATA[jdbc:mysql://localhost:3306/xutest?serverTimezone=UTC&characterEncoding=utf-8]]></entry>
<entry key="userName">root</entry>
<entry key="password">xuxu</entry>

可为什么mybatis为报错说是'Administrator'@'localhost'出错呢?

原来userName在作为key的话,环境环境变量中也有一个userName作为key的值,重新换掉改为其它与userName不一样即可解决问题。

原文地址:https://www.cnblogs.com/xuxu-dragon/p/5884215.html