第一个是 在连接数据库的时候一直连接不上,报出
Caused by: java.sql.SQLException: Access denied for user 'minjj'@'localhost' (using password: YES)
的错误,但是数据库连接账号应该是root, 可能是在配置文件直接配置了username=root,spring读取配置文件时,${username}可能读到了电脑的管理员名称产生了冲突. 只需要将配置文件中username稍作修改就连接成功了.
第二个是 上面的问题解决之后又出现了 The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone. 这样的错误. 这个错误的原因是mysql jdbc驱动包太新的原因,jar包版本是6.0.3的,
只需要在数据库连接url加上serverTimezone =UTC即可
db.url=jdbc:mysql://127.0.0.1:3306/mssm?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC