无法从我的PC中的MySQL Workbench访问VPS中的MySQL容器

发布于 2025-01-22 19:13:29 字数 232 浏览 3 评论 0原文

我已经创建了一个docker容器,该容器在其上运行mySQL并将其公开在do液滴(ubuntu 20)上的默认端口(3306)上。

我尝试使用以下参数在笔记本电脑上访问它: 主机名:( VPS的IP地址。我还尝试了公共网关IP) 连接:标准(TCP/IP) 港口:3306 用户名:根 密码:(我在创建容器时设置的密码)

错误消息只是说“无法连接到Localhost” 我是否错过了可能将容器暴露到Internet的步骤?

I've created a docker container that runs MySQL on it and exposes it on the default port (3306) on a DO droplet (Ubuntu 20).

I tried accessing it on my laptop with the following parameters:
Hostname: (VPS's IP address. I also tried Public Gateway IP)
Connection: Standard (TCP/IP)
Port: 3306
Username: root
Password: (Password I have set while creating the container)

The error message just says "Could not connect to localhost"
Am I missing a step that maybe exposes the container to the internet?

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

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

发布评论

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

评论(1

画▽骨i 2025-01-29 19:13:29

几个小时后,我发现docker Run命令必须具有-p参数。 -p = 3306:3306在我的情况下。

After a couple of hours, I found out that the docker run command has to have -p parameter. -p=3306:3306 in my case.

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