IDEA无法连接docker中的数据库的问题

问题最后无解,或许可以通过抓包发现原因,但是经过两个小时的蛮力测试,最后证明可能当前应用的运行环境有关。
毕竟生成环境用的就是简单的‘123456’。

问题现象:
本地idea起springboot的微服务,以com.alibaba.druid.pool.DruidDataSource连接池连接docker中安装的。

datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.jdbc.Driver
    url: 'jdbc:mysql://127.0.0.1:3306/user?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&verifyServerCertificate=false'
    username: root
    password: '123456'
    druid:
      initialSize: 50
      minIdle: 50
      maxActive: 300
      maxWait: 60000
      timeBetweenEvictionRunsMillis: 60000
      minEvictableIdleTimeMillis: 300000
      validationQuery: SELECT user()
      testWhileIdle: true
      testOnBorrow: false
      testOnReturn: false
      poolPreparedStatements: true
      connection-properties: druid.stat.mergeSql:true;druid.stat.slowSqlMillis:5000

相关版本
连接池

<dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>druid-spring-boot-starter</artifactId>
        <version>1.1.20</version>
</dependency>

数据库

dockerfile:
FROM mysql:5.7.25

现象
用以下命令可以修改数据库密码

grant all on *.* to root@'%' identified by 't$>9MJ4q' with grant option;
flush privileges;

当密码采用
‘123456’或者‘abcdef’时无法连接;当密码采访复杂的’t$>9MJ4q’时,就可以直接连接成功。

尝试了各种所谓密码需要用‘’包裹的方式,都无效。

猜你喜欢

转载自blog.csdn.net/xihuanyuye/article/details/104667550