{
  "id": "database/mysql-data-directory-permission",
  "signature": "ERROR 1017 (HY000): Can't find file: './mydb/tables.ibd' (errno: 13 - Permission denied)",
  "signature_zh": "错误 1017 (HY000)：找不到文件：'./mydb/tables.ibd'（错误号：13 - 权限被拒绝）",
  "regex": "ERROR 1017 \\(HY000\\): Can't find file: '.*\\.ibd' \\(errno: \\d+ - Permission denied\\)",
  "domain": "database",
  "category": "system_error",
  "subcategory": null,
  "root_cause": "The MySQL server process cannot read or write the .ibd file due to incorrect file permissions or ownership on the data directory.",
  "root_cause_type": "generic",
  "root_cause_zh": "MySQL 服务器进程由于数据目录上的文件权限或所有权不正确，无法读取或写入 .ibd 文件。",
  "versions": [
    {
      "version": "MySQL 8.0.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "MySQL 5.7.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "MariaDB 10.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Running chmod 777 on the .ibd file",
      "why_fails": "Excessive permissions can cause security issues and MySQL may still fail if the parent directory permissions are wrong; also not a sustainable fix.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Restarting MySQL without fixing permissions",
      "why_fails": "Restarting does not change file permissions; the error will reappear on the next access.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Fix ownership: chown mysql:mysql /var/lib/mysql/mydb/tables.ibd; then ensure parent directories have correct permissions: chmod 750 /var/lib/mysql/mydb",
      "success_rate": 0.9,
      "how": "Fix ownership: chown mysql:mysql /var/lib/mysql/mydb/tables.ibd; then ensure parent directories have correct permissions: chmod 750 /var/lib/mysql/mydb",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using AppArmor or SELinux, check and update policies: ausearch -m avc -ts recent; then restorecon -R /var/lib/mysql",
      "success_rate": 0.8,
      "how": "If using AppArmor or SELinux, check and update policies: ausearch -m avc -ts recent; then restorecon -R /var/lib/mysql",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "修复所有权：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"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://dev.mysql.com/doc/refman/8.0/en/data-directory.html",
  "official_doc_section": null,
  "error_code": "1017",
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2023-07-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}