《Docker系列》Docker安装MySQL报错:mysqld failed while attempting to check config....mysqld: Can‘t read dir

这篇具有很好参考价值的文章主要介绍了《Docker系列》Docker安装MySQL报错:mysqld failed while attempting to check config....mysqld: Can‘t read dir。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

docker安装mysql失败,Docker,mysql,docker,数据库

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 \

[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模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包