MySQL cannot read the referenced directory because the operating system returned a failure such as permission denied, missing path, or filesystem corruption.
MySQL Error 12: EE_DIR means the server failed to read a directory named in the message. Check OS errno for the root cause, restore directory permissions or create the missing path, then retry the statement to resolve the issue.
Can't read dir of '%s' (OS errno %d - %s)
MySQL raises Error 12 with condition EE_DIR when it tries to scan or open a directory and the operating system denies access. The full text is "Can't read dir of '%s' (OS errno %d - %s)", where %s expands to the directory path and the final placeholder shows the OS error description.
The error surfaces during file-based operations such as LOAD DATA, SELECT ... INTO OUTFILE, log rotation, or table discovery on disk.
Because the engine depends on the filesystem, correcting the underlying OS problem is crucial for server stability.
Permission mismatches, missing directories, SELinux/AppArmor policies, and hardware issues lead the kernel to refuse directory reads. MySQL only relays the errno and cannot continue, so the client receives Error 12 immediately.
Using containerized deployments amplifies the risk because volume mounts may be read-only or mis-mapped.
Large instances also encounter inode exhaustion, which blocks directory access even when space remains.
Start with the OS errno shown in the message. Errno 13 signals permission denied, while Errno 2 indicates no such file or directory. Correct the root cause on the host, verify ownership (usually mysql:mysql), and reopen the directory. Restarting the server is rarely required once the path is readable.
After fixing permissions, re-run the failed SQL statement to confirm resolution.
For repeat issues, add a health check that scans the path and alerts before MySQL encounters it.
Load data workflows often specify an incorrect directory in LOCAL INFILE commands. Adjust the secure_file_priv setting or copy the file into the permitted folder.
Binlog or relay-log directories moved during migrations may be missing. Update my.cnf (log_bin, relay_log) and create the directories with correct ownership.
Store all MySQL-managed directories under a dedicated parent owned by the mysql user.
Automate permission checks in deployment scripts.
Galaxy’s desktop SQL editor lets engineers centralise vetted LOAD DATA and OUTFILE queries in shared Collections. Endorsed queries reduce typos and ensure paths comply with secure_file_priv, preventing EE_DIR before it happens.
Error 29 (OS errno 13 - Permission denied) appears when reading a file, not a directory. Fix it by adjusting file permissions similarly.
Error 1030 (HY000 - Got error X from storage engine) can wrap EE_DIR on older versions.
Inspect the MySQL error log to reveal the underlying errno and repair the directory path.
.
No. Errno 2 means the directory is missing, while Errno 30 means the filesystem is read-only. Interpret the errno before acting.
Yes. Once the directory becomes readable, the server continues normally. Only redo the failed SQL statement.
If secure_file_priv is set, MySQL refuses to read or write outside that folder. Referencing another directory triggers EE_DIR with Errno 13.
Galaxy centralises endorsed queries, allowing admins to approve paths that comply with secure_file_priv. Shared context prevents developers from using invalid directories.