《Docker系列》Docker安装MySQL报错:mysqld failed while attempting to check config....mysqld: Can‘t read dir
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.7358163e8d564ff111a41efe06e83798c9518a65300502c12a63776c6a3639a8c
2 通过查看该容器的日志,可以看到主要是因为读取不到/etc/mysql/conf.d/
目录
[root@zxy_master apps]# docker logs -f 358163e8d5642022-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 \
[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.7faf2312fd62ad4ebe05ba2cffa9917b47417cfad1f8175912e1e0bc6e089986c
4 再次检查已经启动成功,报错原因主要是没有指定到conf.d
目录,导致容器在启动的时候找不到该目录。
[root@zxy_master apps]# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESfaf2312fd62a 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
来源地址:https://blog.csdn.net/m0_51197424/article/details/128389622
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341