如何使用Sequel Pro连接到在docker上运行的mysql

时间:2016-01-20 10:28:51

标签: mysql docker sequelpro

我有一个docker-machine,它有一个运行的mysql容器。

~
▶ boot2docker ip
192.168.59.103
~                                                                                                                                                                       
▶ docker-machine ip default
192.168.99.100

~
▶ docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER   ERRORS
default   *        virtualbox   Running   tcp://192.168.99.100:2376           v1.9.1

~
▶ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                              NAMES
b14062dd1e25        mysql:5.6           "/entrypoint.sh mysql"   6 hours ago         Up 6 hours          3306/tcp, 0.0.0.0:3306->9090/tcp   i-mysql

来自docker logs i-mysql

的日志
2016-01-20 04:14:41 1 [Note] InnoDB: Highest supported file format is Barracuda.
2016-01-20 04:14:41 1 [Note] InnoDB: 128 rollback segment(s) are active.
2016-01-20 04:14:41 1 [Note] InnoDB: Waiting for purge to start
2016-01-20 04:14:41 1 [Note] InnoDB: 5.6.28 started; log sequence number 1625997
2016-01-20 04:14:41 1 [Note] Server hostname (bind-address): '*'; port: 3306
2016-01-20 04:14:41 1 [Note] IPv6 is available.
2016-01-20 04:14:41 1 [Note]   - '::' resolves to '::';
2016-01-20 04:14:41 1 [Note] Server socket created on IP: '::'.
2016-01-20 04:14:41 1 [Warning] 'proxies_priv' entry '@ root@b14062dd1e25' ignored in --skip-name-resolve mode.
2016-01-20 04:14:41 1 [Note] Event Scheduler: Loaded 0 events
2016-01-20 04:14:41 1 [Note] mysqld: ready for connections.
Version: '5.6.28'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)

如何使用Sequel Pro从运行OSX的localhost笔记本电脑连接到此容器中的mysql实例。

我正在使用以下设置,但似乎无法连接:

enter image description here

  

无法连接到主机192.168.99.100,或请求超时。

     

确保地址正确并且您有必要的地址   特权,或尝试增加连接超时(目前为10   秒)。

     

MySQL说:无法连接到'192.168.99.100'(61)

上的MySQL服务器

2 个答案:

答案 0 :(得分:0)

您是否已向root用户添加了来自主机ip的请求的权限?

答案 1 :(得分:0)

您正在将容器端口9090暴露给主机端口3306.也许您想要相反的方式。当您启动容器时,请将-p标志参数从9090:3306更改为3306:9090