在Docker容器和MySQL Workbench中与Mariadb的连接

发布于 2025-01-25 11:27:52 字数 627 浏览 2 评论 0原文

我使用以下命令创建了一个正在运行MariaDB的Docker容器:

docker run -d --name some-mariadb -p 3306:3306 -e MARIADB_USER=example-user -e MARIADB_PASSWORD=<enter password> -e MARIADB_ROOT_PASSWORD=<enter password>  mariadb 

在将iPaddress放入iPaddress时,我无法成功测试MySQL Workbench中的连接(通过在下面运行Docker命令找到它)以及用户(示例 - 用户)和密码(尝试了MaridB_Password和Mariadb_root_password的密码)。

我得到的只是“无法连接到主机”

docker命令获取iPaddress:

docker container inspect some-mariadb

请注意,当我在下面运行命令时,我可以看到Mariadb [(none)]&gt;终端。

docker exec -it some-mariadb mysql -u example-user -p

I created a docker container that's running MariaDb using the command below:

docker run -d --name some-mariadb -p 3306:3306 -e MARIADB_USER=example-user -e MARIADB_PASSWORD=<enter password> -e MARIADB_ROOT_PASSWORD=<enter password>  mariadb 

I'm not able to successfully test the connection in mysql workbench when putting in the IPAddress (found it by running the docker command below) along with the user (example-user) and password (tried the passwords for MARIDB_PASSWORD and MARIADB_ROOT_PASSWORD).

All I get is "unable to connect to host"

Docker command to get IPAddress:

docker container inspect some-mariadb

Note that when I run the command below I am able to see the MariaDB [(none)]> terminal.

docker exec -it some-mariadb mysql -u example-user -p

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

居里长安 2025-02-01 11:27:52

我能够使用Localhost(127.0.0.1)IP地址创建连接。用户和Mariadb_root_password没有问题。

I was able to create a connection using the localhost (127.0.0.1) IP address. The user and MARIADB_ROOT_PASSWORD had no issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文