Docker安装MySQL报错:mysqld failed while attempting to check config…mysqld: Can’t read dir of ‘/etc/mysql/conf.d/’…
[ERROR] [Entrypoint]: mysqld failed while attempting to check config command was: mysqld --verbose --help --log-bin-index=/tmp/tmp.Frnt2oibYI mysqld: Can't read dir of '/etc/mysql/conf.d/' (Errcode: 2 - No such file or directory)
1 最初的时候使用如下命令创建容器,但是创建之后通过docker ps
查看不到启动的容器
[root@zxy_master mysql01]# docker run -p 33061:3306 --name mysql01 \
> -v /zxy/apps/docker_mysql/mysql01/conf:/etc/mysql \
> -v /zxy/apps/docker_mysql/mysql01/data:/var/lib/mysql \
> -v /zxy/apps/docker_mysql/mysql01/log:/var/log/mysql \
> -e MYSQL_ROOT_PASSWORD=123456 \
> -d mysql:5.7
358163e8d564ff111a41efe06e83798c9518a65300502c12a63776c6a3639a8c
2 通过查看该容器的日志,可以看到主要是因为读取不到/etc/mysql/conf.d/
目录
[root@zxy_master apps]# docker logs -f 358163e8d564
2022-12-20 05:46:26+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.40-1.el7 started.
2022-12-20 05:46:26+00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config
command was: mysqld --verbose --help --log-bin-index=/tmp/tmp.XeHsvFblmW
mysqld: 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!
3 -v /zxy/apps/docker_mysql/mysql01/conf:/etc/mysql
修改为
-v /zxy/apps/docker_mysql/mysql01/conf:/etc/mysql/conf.d \
文章来源:https://www.toymoban.com/news/detail-519658.html
[root@zxy_master apps]# docker run -p 33061:3306 --name mysql01 \
> -v /zxy/apps/docker_mysql/mysql01/conf:/etc/mysql/conf.d \
> -v /zxy/apps/docker_mysql/mysql01/data:/var/lib/mysql \
> -v /zxy/apps/docker_mysql/mysql01/log:/var/log/mysql \
> -e MYSQL_ROOT_PASSWORD=123456 \
> -d mysql:5.7
faf2312fd62ad4ebe05ba2cffa9917b47417cfad1f8175912e1e0bc6e089986c
4 再次检查已经启动成功,报错原因主要是没有指定到conf.d
目录,导致容器在启动的时候找不到该目录。文章来源地址https://www.toymoban.com/news/detail-519658.html
[root@zxy_master apps]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
faf2312fd62a mysql:5.7 "docker-entrypoint.s…" 3 seconds ago Up 2 seconds 33060/tcp, 0.0.0.0:33061->3306/tcp, :::33061->3306/tcp mysql01
到了这里,关于《Docker系列》Docker安装MySQL报错:mysqld failed while attempting to check config....mysqld: Can‘t read dir的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!