1017
database
system_error
ai_generated
true
ERROR 1017 (HY000): Can't find file: './mydb/tables.ibd' (errno: 13 - Permission denied)
ID: database/mysql-data-directory-permission
88%Fix Rate
88%Confidence
1Evidence
2023-07-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| MySQL 8.0.x | active | — | — | — |
| MySQL 5.7.x | active | — | — | — |
| MariaDB 10.x | active | — | — | — |
Root Cause
The MySQL server process cannot read or write the .ibd file due to incorrect file permissions or ownership on the data directory.
generic中文
MySQL 服务器进程由于数据目录上的文件权限或所有权不正确,无法读取或写入 .ibd 文件。
Official Documentation
https://dev.mysql.com/doc/refman/8.0/en/data-directory.htmlWorkarounds
-
90% success Fix ownership: chown mysql:mysql /var/lib/mysql/mydb/tables.ibd; then ensure parent directories have correct permissions: chmod 750 /var/lib/mysql/mydb
Fix ownership: chown mysql:mysql /var/lib/mysql/mydb/tables.ibd; then ensure parent directories have correct permissions: chmod 750 /var/lib/mysql/mydb
-
80% success If using AppArmor or SELinux, check and update policies: ausearch -m avc -ts recent; then restorecon -R /var/lib/mysql
If using AppArmor or SELinux, check and update policies: ausearch -m avc -ts recent; then restorecon -R /var/lib/mysql
中文步骤
修复所有权: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
Dead Ends
Common approaches that don't work:
-
Running chmod 777 on the .ibd file
70% fail
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% fail
Restarting does not change file permissions; the error will reappear on the next access.