The server cannot determine its current working directory, usually due to missing folders or insufficient OS permissions, so startup or file operations fail.
MySQL Error 1014: ER_CANT_GET_WD occurs when the server cannot get its working directory because the path is missing or permissions are wrong. Confirm the datadir exists and grant the MySQL user read and execute rights to resolve the problem.
Can't get working directory (errno: %d - %s)
MySQL Error 1014 with condition ER_CANT_GET_WD and SQLSTATE HY000 means the server process failed to obtain its current working directory. The error appears during startup, INSTALL PLUGIN, or other file-based operations and immediately halts the requested action.
The operating system call getcwd or chdir returns an error because the directory does not exist, is unreachable, or the MySQL service account lacks read and execute permissions.
The server exits or refuses the statement until the environment issue is corrected.
Missing or moved datadir, base directory, or plugin directory is the most common trigger. If the folder referenced by the mysqld --basedir or --datadir option was deleted, renamed, or on an unmounted volume, MySQL cannot resolve the path.
Incorrect file system permissions also raise Error 1014.
The MySQL OS user must have at least execute rights on every folder in the path to call getcwd successfully.
Security layers such as SELinux, AppArmor, or Windows UAC can block directory access and cause the same failure even when Unix permissions look correct.
Containerized deployments sometimes start mysqld in a directory that disappears after build, leaving the process without a valid working directory.
Confirm the failing path.
Review mysqld logs or the message that follows the errno placeholder, then verify the directory exists on disk.
Grant the MySQL user ownership or at minimum rwx on the directory. On Linux run: chown -R mysql:mysql /var/lib/mysql and chmod 750 /var/lib/mysql. Restart the service and watch the log.
Update configuration files if paths changed. Edit my.cnf to point datadir, basedir, plugin_dir, and tmpdir to valid folders.
After saving, reload the daemon and restart mysqld.
For SELinux, create a policy module or run chcon -t mysqld_db_t /var/lib/mysql -R.
On AppArmor, adjust /etc/apparmor.d/usr.sbin.mysqld to allow the directory.
Container rebuild removed the workdir - mount the host volume at the same mount point or add WORKDIR /var/lib/mysql in the Dockerfile.
Windows service runs as Local Service without rights - open Services, Properties, Log On, and switch to the dedicated MySQL user that owns the data directory.
Deployment moved datadir - create a symlink ln -s /mnt/data/mysql /var/lib/mysql or update my.cnf accordingly and restart.
Store datadir on a fixed, persistent path and add integrity checks in deployment scripts to verify directory presence before restarting MySQL.
Use Galaxy's path validation.
When you open my.cnf in the Galaxy SQL editor, the built-in linter flags nonexistent directories and highlights permission risks before you apply the configuration.
Monitor MySQL startup logs with a centralized tool and set alerts for "ER_CANT_GET_WD" so you can act before production traffic is impacted.
Error 1010 ER_DB_DROP_EXISTS indicates an attempt to drop a database that still exists.
Verify DROP DATABASE statement.
Error 1049 ER_BAD_DB_ERROR fires when connecting to a database name that does not exist. Create the database or correct the name.
Error 1017 ER_CANT_READ_DIR refers to directory read failures often linked to permission problems like Error 1014. Troubleshooting steps are similar: check folder existence and rights.
.
The path defined in datadir, basedir, tmpdir, or plugin_dir does not exist because it was deleted, renamed, or is on an unmounted volume.
The MySQL operating system user lacks execute permission on one or more folders in the path, preventing getcwd from resolving the current directory.
SELinux, AppArmor, or antivirus software blocks access to the working directory despite correct Unix permissions.
Container images or scripts start mysqld in a directory that disappears after build, leaving the process with no valid working directory.
.
Yes. If mysqld cannot obtain its working directory, initialization halts and the server fails to start until the path issue is fixed.
No. This error stems from the operating system, so you must fix file paths or permissions outside MySQL, then restart the service.
Moving datadir does not delete data, but you must copy files to the new location and adjust permissions before restarting MySQL.
Galaxy's SQL editor linter checks configuration files for invalid paths and highlights risks, preventing Error 1014 before deployment.