把项目从Windows下导入到Ubuntu时,项目启动时报错。
这是报错是连接数据库的配置:

反复检查了很多次都没有发现错误在那里,此时这个项目Windows环境下可以正常启动。我认为是我Ubuntu系统下的mysql配置出现了问题。就写了个方法测试:

测试通过并且可以查询到数据。。。。相当郁闷
最后在发现是在Linux下,数据库连接的密码配置需要加上单引号。

这是报错是连接数据库的配置:
本文标题:连接mysql报错errorCode 1045, state 2
本文链接:https://www.haomeiwen.com/subject/axxkpctx.html
网友评论