【问题标题】:connect mysql docker container from another wrong host从另一个错误的主机连接 mysql docker 容器
【发布时间】:2016-07-02 10:36:44
【问题描述】:

我创建了一个 mysql 容器:

  $ sudo docker inspect ca3370a5a299 | grep IPAddress
    [sudo] password for danny: 
            "IPAddress": "172.17.0.42",

并将fedora容器链接到它,但是当我尝试连接到fedora容器中的mysql容器时,我总是得到错误的主机(172.17.0.47是fedora容器的IP地址):

sudo docker run -d -it  --link  ca3370a5a299:mysql fedora 

mysql  --host 172.17.0.42 -u root -p 
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'172.17.0.47' (using password: YES)

编辑: 我确保数据库正在运行并在容器本身内连接到它

sudo docker exec -it  websites-mysql  bash
mysql -u root -p
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.12 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> quit

【问题讨论】:

    标签: mysql containers


    【解决方案1】:

    也许反对票是因为我应该在 serverfault 网站上发布这个问题?无论如何,我在here 上发现了一个类似的问题,结果我误解了错误。错误意味着来自 Fedora 容器的用户访问被拒绝。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-05
      • 2015-11-28
      • 2019-09-04
      • 1970-01-01
      • 2017-11-02
      • 2015-01-07
      • 1970-01-01
      • 2021-05-09
      相关资源
      最近更新 更多