我使用以下命令创建了一个Docker容器:
docker run --network host --name mariadb -e MYSQL_ROOT_PASSWORD=testpass -d mariadb:latest
我正在尝试连接到IntelliJ项目中的MariaDB Docker容器,并收到以下错误:
The specified database user/password combination is rejected:
[28000][1045] Access denied for user 'root'@'127.0.0.1' (using password: YES)
当我在没有--network host
的情况下运行并使用容器的IP 172.18.0.2
时,出现以下错误:
[08][-1] Could not connect to address=(host=172.18.0.2)(port=3306)(type=master) : connect timed out
java.net.SocketTimeoutException: connect timed out.
我什至尝试更新容器中my.cnf
文件中的绑定地址,但没有成功。
请帮助我。
答案 0 :(得分:0)
答案 1 :(得分:0)
可能您使用另一个密码多次运行了Docker容器。因此,请尝试删除容器和卷。
您可以通过以下命令获取音量:
docker inspect -f '{{ .Mounts }}' <containerId>