1 docker 安装 mysql 错误
通过 docker logs
发现
[ERROR] [Entrypoint]: mysqld failed while attempting to check configcommand was: mysqld --verbose --help --log-bin-index=/tmp/tmp.WHijR591XAmysqld: Can't read dir of '/etc/mysql/conf.d/' (Errcode: 2 - No such file or directory)
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
意思就是说没找到 /etc/mysql/conf.d 这个文件夹
解决办法
参考:https://blog.csdn.net/javaboyweng/article/details/130928503
文章第四步的容器启动命令更改为
docker run -p 3306:3306 --name mysql \
-v /mydata/mysql/log:/var/log/mysql \
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=root \
-d mysql:5.7