大网数据广告活动
服务器运维问答

Cant read dir of /etc/my.cnf. (Errcode: 2)

· 52CE 我爱测

I am running MariaDB (libmysql - 5.5.41-MariaDB) and today I noticed that I couldn't go to mysql via command line to create a dump file. It would throw an error: mysql: Can't read dir of '/etc/my.cnf.' (Errcode: 2) Fatal error in…

问题原文

原帖链接 · user3186337 · CC BY-SA 3.0

I am running MariaDB (libmysql - 5.5.41-MariaDB) and today I noticed that I couldn't go to mysql via command line to create a dump file. It would throw an error:

mysql: Can't read dir of '/etc/my.cnf.' (Errcode: 2) Fatal error in defaults handling. Program aborted

Not sure why it needs to read a directory named "my.cnf." but I do see a directory called "my.cnf.d" in etc folder. Possibly a typo of some sort but when I went to my my.cnf file, I didn't notice any settings for this. The only thing closely relates to it is this:

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

This is something that recently occurred without me changing anything in the settings so I am not sure what is going on with mariadb. Any help would be appreciated.

EDIT: Okay, I solved the issue by doing mkdir my.cnf. (not sure what this directory is needed for as nothing is inside it. Never changed anything to my.cnf for it to start requiring this directory..

已采纳解答

原帖链接 · user9517 · CC BY-SA 3.0

Given that it works when you disable reading the defaults (--no-defaults) then the problem is located somewhere in the default files, their permissions or the permissions of the directories containing them.

Carefully examine the permissions on /etc, /etc/my.cnf, /etc/my.cnf.d, the files inside /etc/my.cnf.d as well as for good measure ~/.my.cnf.

Check the contents of each file for more includes and any other directives that may access files.

If SELinux is enabled, check the contents of /var/log/audit.log for relevant AVC denied entries.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-08-24)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。