The MySQL server fails to read its current working directory because the directory is missing or inaccessible to the mysqld process.
MySQL Error 16 EE_GETWD occurs when mysqld returns "Can't get working directory (OS errno)". The startup or data directory is missing, has been moved, or lacks OS permissions. Restore or recreate the path and grant read-execute rights to the MySQL user, then restart the service to resolve the issue.
Can't get working directory (OS errno %d - %s)
MySQL raises Error 16 EE_GETWD with the message "Can't get working directory (OS errno %d - %s)" when the server binary cannot execute getcwd at startup. The call fails if the directory that mysqld treats as its current working directory has been deleted, renamed, or made inaccessible.
The error is global and prevents the server from completing initialization.
Clients cannot connect until the working directory problem is resolved, making a quick fix critical for production uptime.
Missing directory triggers the error most often. If administrators delete or move the folder from which mysqld was launched, getcwd fails and the server aborts with EE_GETWD.
Incorrect file-system permissions are a second common cause.
When the MySQL user loses execute rights on one element of the path, the operating system denies the getcwd call, leading to the same failure during startup or restart.
First, identify the path that mysqld expects. Check systemd service files or startup scripts for the WorkingDirectory or datadir settings. Verify that the directory exists and has correct ownership.
Next, restore the path or adjust permissions.
Recreate the folder if it was deleted, then run chown mysql:mysql /path and chmod 750 /path to grant the MySQL user read and execute access. Finally, restart mysqld and confirm that the error disappears.
After an accidental rm -rf in /var/lib/mysql, EE_GETWD appears. Restoring a backup of the folder and setting proper ownership resolves the issue.
During container orchestration, a volume mount fails, leaving the configured datadir missing.
Updating the Docker Compose path or rebuilding the container with the correct mount fixes the startup error.
Always use absolute paths in systemd service files and Docker Compose definitions so that relocating scripts does not impact mysqld.
Implement file-system monitoring to alert on deleted or permission-changed MySQL directories. Regular audits catch configuration drift before it triggers EE_GETWD.
Error 2002 "Can't connect to local MySQL server" often follows EE_GETWD because the server never started.
Fixing EE_GETWD clears 2002 automatically.
Error 13 "Permission denied" may occur on log files when directory rights are tightened. Align ownership and restart mysqld to remove both errors.
.
Yes. The getcwd call happens during mysqld initialization. Once the server is running, deleting the directory will not crash it but will cause errors on the next restart.
Absolutely. Edit /etc/systemd/system/mysqld.service and set WorkingDirectory to a stable path, then run systemctl daemon-reload.
If a volume mount defined in Docker Compose is missing, mysqld starts in a directory that vanishes, leading to the error. Fix by correcting the mount.
Galaxy keeps all server connection details versioned. If datadir changes, update the connection once and share the change across your team, minimizing misconfigured restarts.