0
votes

I am now using Docker for Mac and Docker is Docker version 1.12.0-rc4, build e4a0dbc, experimental and I am trying to install MySQL in Ubuntu 16.10. (Do not ask me, why I don't use the official one!)

The installation process is

run Docker

docker run --rm -it ubuntu:16.10

(and install vim)

update & upgrade apt-get

apt-get update && apt-get upgrade -y

apt-get mysql-server

apt-get install -y mysql-server

dump /etc/mysql/my.cnf

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

dump /etc/mysql/mysql.conf.d/mysqld.cnf

[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock
...
[mysqld]
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306

find /var/run/mysqld/mysqld.sock

# ls /var/run/
lock  mount  utmp <- there is no "mysqld" directory

Why I am making this mistake for several times and cannot use MySQL... ><

1

1 Answers

1
votes

If you are trying to access mysql from your host system, your problem is that you aren't exposing port 3306 when you run the ubuntu image:

you need to add this to the run command:

docker run --rm -it -p 3306:3306 ubuntu:16.10

Can't imagine why you aren't using one of the usual mysql images, though you'd still have to expose the port.