Springboot uses druid to log in MySQL. An error occurred: access denied: errorcode 1045, state 28000

In case of an error, first of all, check whether the database can be accessed correctly through MySQL instructions:
it is found that the database can be accessed normally

later, when I observed my configuration, I found that my password was all digital. There would be a little problem with all digital passwords in the YML file, so I need to add ‘single quotation mark to correctly identify them. The correct configuration is as follows:

spring:
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/mall?useUnicode=true&characterEncoding=utf8&useOldAliasMetadataBehavior=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=UTC
    username: root
    password: '123456'
    driver-class-name: com.mysql.cj.jdbc.Driver
    type: com.alibaba.druid.pool.DruidDataSource


Read More: