MySQL error 26 (EE_REALPATH) appears when the server cannot resolve an absolute path for a file or directory, usually because the path does not exist or the MySQL process lacks file-system permissions.
MySQL Error 26: EE_REALPATH occurs when the server cannot convert a relative path to an absolute one, often because the file is missing or permissions are wrong. Verify the path exists and set correct OS privileges to resolve the issue.
Error on realpath() on '%s' (Error %d - %s)
Error 26 with condition name EE_REALPATH is raised when MySQL calls the underlying C library function realpath() and that call fails. MySQL then returns the message: Error on realpath() on '%s' (Error %d - %s).
The failure means MySQL could not resolve the supplied path to its absolute canonical form. Queries that read from or write to files – such as LOAD DATA INFILE, SELECT ...
INTO OUTFILE, or calls that rely on the FILE privilege – can all trigger this error.
A non-existent file or directory path leads MySQL to pass an invalid argument to realpath(), causing the error immediately.
Incorrect file-system privileges on the target directory or file (e.g., the mysql user lacks read or execute rights) also prevent realpath() from resolving the path.
Operating-system limits, such as hitting the maximum symbolic-link depth or running out of file descriptors, can make realpath() fail even when the path is correct.
First, confirm the full path you supplied is spelled correctly and actually exists on disk.
Use OS commands like ls -l /path/to/file
.
Next, ensure the MySQL service account owns or can access the directory. On Linux, run chown mysql:mysql /path/to/dir
and chmod 750 /path/to/dir
.
If you are using secure-file-priv, verify that the path falls inside the directory listed by SHOW VARIABLES LIKE 'secure_file_priv'
. Move or copy the file there, or adjust the variable in my.cnf
.
LOAD DATA INFILE fails: The data file sits in /tmp
but secure-file-priv points to /var/lib/mysql-files
.
Move the file and rerun the statement.
SELECT ... INTO OUTFILE fails: The destination directory is writable only by root.
Grant write permission to the mysql user or choose a directory within secure-file-priv.
Always reference absolute paths in file-related SQL rather than relying on relative paths.
Keep the secure-file-priv directory documented and restrict file imports/exports to that location.
Automate permission checks in deployment scripts so new servers apply correct ownership to any shared directories.
MySQL Error 29: File 'xxx' not found – raised when the server cannot open a file after resolving the path.
MySQL Error 13: Can't get stat of file – triggered when MySQL cannot read metadata on the target file.
Fixes are similar: correct permissions and paths.
.
MySQL uses realpath() to ensure the file path is absolute and secure before performing any file I/O. This prevents directory traversal and other security issues.
Setting secure_file_priv to an empty string disables the restriction, but it reduces security. Prefer moving files into the approved directory.
Yes. MySQL for Windows calls the equivalent _fullpath() function. Long path or permission problems will trigger Error 26 there as well.
Galaxy’s SQL editor highlights file-access statements and shows inline linting tips, warning you if the path is outside secure_file_priv. This catches EE_REALPATH issues before you run the query.