docker启动mysql报错Can't read dir of '/etc/mysql/conf.d/'

Posted 逆梦

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker启动mysql报错Can't read dir of '/etc/mysql/conf.d/'相关的知识,希望对你有一定的参考价值。

执行命令:

docker run -p 3306:3306 --privileged=true 
-v /mysql/data:/var/lib/mysql
-v /mysql/log:/var/log/mysql
-v /mysql/conf:/etc/mysql
-e MYSQL_ROOT_PASSWORD=1234qwer
--name=mysql-server -d mysql:8.0.32

 

错误信息:

2023-03-02 01:34:04+00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config
        command was: mysqld --verbose --help --log-bin-index=/tmp/tmp.6VZosksth2
        mysqld: Can\'t read dir of \'/etc/mysql/conf.d/\' (OS errno 2 - No such file or directory)
mysqld: [ERROR] Stopped processing the \'includedir\' directive in file /etc/my.cnf at line 36.
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!

从上面报错信息可以看出 mysqld: Can\'t read dir of \'/etc/mysql/conf.d/\' (无法读取/etc/mysql/conf.d/目录)。这样就知道原因了,mysql找不到conf.d目录。所以启动容器时指定到conf.d目录

修改命令:

docker run -p 3306:3306 --privileged=true 
-v /mysql/data:/var/lib/mysql 
-v /mysql/log:/var/log/mysql 
-v /mysql/conf:/etc/mysql/conf.d 
-e MYSQL_ROOT_PASSWORD=1234qwer --name=mysql-server -d mysql:8.0.32

 

以上是关于docker启动mysql报错Can't read dir of '/etc/mysql/conf.d/'的主要内容,如果未能解决你的问题,请参考以下文章

mariadb 二进制启动报错,Can't find messagefile '/usr/local/mysql/share/mysql/errmsg.sys'

用Navicat连接mysql报错:2003-Can't connect to MySql server on '10.100.0.109'(10039)

Mysql报错Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't

源码安装mysql5.6x启动报错:[ERROR] Can't find messagefile '/data/mysqldata/3306/english/errmsg.sys

mysql报错1024-can't get hostname for your address

连接数据库报错:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mys