简体   繁体   中英

Ubuntu 16.10 in Docker 1.12 claims there is no socket for MySQL

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... ><

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM