当我在Docker镜像中使用ubuntu 16.04和最新的
mysql 5.7.19-0ubuntu0.16.04.1时,会显示此错误消息.
可以做些什么来解决这个问题?
重现错误
>获取Dockerfile:
FROM ubuntu:16.04
RUN apt update
RUN DEBIAN_FRONTEND=noninteractive apt install -y mysql-server
(也可用here)
>构建并运行:
docker build -t mysqlfail .
docker run -it mysqlfail tail -1 /var/log/mysql/error.log
本来会显示以下错误日志:
2017-08-26T11:48:45.398445Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the –initialize-insecure option.
这正是我们想要的:没有设置root密码的mysql.
>在过去(ubuntu 14.04 / mysql 5.5),服务mysql启动是可能的.现在如果你试试这个就失败了
docker run -it mysqlfail service mysql start
* Starting MySQL database server mysqld
No directory, logging in with HOME=/
[fail]
和/var/log/mysql/error.log包含一行: