mysqld: Can‘t read dir of ‘/etc/mysql/conf.d/‘ (Errcode: 13 - Permission denied)

Posted 赵广陆

tags:

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

在安装docker mysql:5.7版本时,出现错误:

mysqld: Can't read dir of '/etc/mysql/conf.d/' (Errcode: 13 - Permission denied)
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!

ERROR: mysqld failed while attempting to check config
command was: "mysqld --verbose --help"

原因
因为Centos7安全Selinux禁止了一些安全权限,导致mysql和mariadb在进行挂载/var/lib/mysql的时候会提示如下信息

解决方法
在docker run中加入 --privileged=true 给容器加上特定权限

docker run -id --privileged=true \\
-p 3306:3306 \\
--name=c_mysql \\
-v $PWD/conf:/etc/mysql/conf.d \\
-v $PWD/logs:/logs \\
-v $PWD/data:/var/lib/mysql \\
-e MYSQL_ROOT_PASSWORD=root \\
mysql:5.6

以上是关于mysqld: Can‘t read dir of ‘/etc/mysql/conf.d/‘ (Errcode: 13 - Permission denied)的主要内容,如果未能解决你的问题,请参考以下文章

my_print_defaults: Can‘t read dir of ‘/etc/my.cnf.

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

Echarts报错 Can't read property 'getWidth' of null

Vue路由初始化Can't read prooerty '$createElement' of undefined

解决 Fatal error: Please read "Security" section of the manual to find out how to run mysqld

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'解决