1017
database
system_error
ai_generated
true
错误 1017 (HY000):找不到文件:'./mydb/tables.ibd'(错误号:13 - 权限被拒绝)
ERROR 1017 (HY000): Can't find file: './mydb/tables.ibd' (errno: 13 - Permission denied)
ID: database/mysql-data-directory-permission
88%修复率
88%置信度
1证据数
2023-07-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| MySQL 8.0.x | active | — | — | — |
| MySQL 5.7.x | active | — | — | — |
| MariaDB 10.x | active | — | — | — |
根因分析
MySQL 服务器进程由于数据目录上的文件权限或所有权不正确,无法读取或写入 .ibd 文件。
English
The MySQL server process cannot read or write the .ibd file due to incorrect file permissions or ownership on the data directory.
官方文档
https://dev.mysql.com/doc/refman/8.0/en/data-directory.html解决方案
-
修复所有权:chown mysql:mysql /var/lib/mysql/mydb/tables.ibd;然后确保父目录权限正确:chmod 750 /var/lib/mysql/mydb
-
如果使用 AppArmor 或 SELinux,检查和更新策略:ausearch -m avc -ts recent;然后 restorecon -R /var/lib/mysql
无效尝试
常见但无效的做法:
-
Running chmod 777 on the .ibd file
70% 失败
Excessive permissions can cause security issues and MySQL may still fail if the parent directory permissions are wrong; also not a sustainable fix.
-
Restarting MySQL without fixing permissions
95% 失败
Restarting does not change file permissions; the error will reappear on the next access.