SpringBoot连接mysql密码正确但SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: YES)

SpringBoot连接mysql密码正确但SQLException: Access denied for user ‘root’@‘localhost’ (using password: YES)

yaml:
SpringBoot连接mysql密码正确但SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: YES)

SpringBoot连接mysql密码正确但SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: YES)
SpringBoot连接mysql密码正确但SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: YES)
SpringBoot连接mysql密码正确但SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: YES)
SpringBoot连接mysql密码正确但SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: YES)
SpringBoot连接mysql密码正确但SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: YES)

properties:
SpringBoot连接mysql密码正确但SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: YES)
SpringBoot连接mysql密码正确但SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: YES)
debug发现,在使用yaml配置文件,用户名和密码没有加双引号会自动转换为int或者double类型,如果用户名或密码是0开头就会报错,因为0开头的数字在进行转换时由于double和int类型的存储方式与String不一样会导致密码改变,加了双引号就没问题,如果是使用properties文件就不用加双引号,properties如果加上双引号会报错,因为他是当做字符串来读取的,就会变成""081020""两个双引号就会报错。

SpringBoot连接mysql密码正确但SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: YES)

上一篇:【debug】-bash: ./*.sh: Permission denied 解决


下一篇:Docker启动提示Get Permission Denied