Error 2063 appears when a LOAD DATA, SELECT INTO OUTFILE, or LOCAL INFILE statement references a path or file name that exceeds the operating system’s maximum length.
MySQL Error 2063: CR_FILE_NAME_TOO_LONG is raised when the client supplies a file path longer than the OS allows. Shorten or restructure the path and rerun the statement to fix the issue.
File name is too long CR_FILE_NAME_TOO_LONG was added in 8.0.1.
MySQL error 2063 signals that the file name or full path you supplied to a file-handling statement exceeds the length limit enforced by your operating system or MySQL client library. The server rejects the request and aborts the statement.
The error is client-side, introduced in MySQL 8.0.1, and typically appears during LOAD DATA INFILE, LOCAL INFILE, or SELECT ... INTO OUTFILE operations.
Most operating systems restrict full path length to 255–4096 bytes. When the combined directory structure, file name, and extension exceed that threshold, the MySQL client returns CR_FILE_NAME_TOO_LONG before even contacting the server.
Additional triggers include accidental double slashes, environment variables expanding into long strings, or generated temp paths in containerized environments where working directories are deeply nested.
First, verify the failing path length with the OS utility (e.g., echo ${#filename}
on Linux). If the length exceeds the limit, relocate the file or shorten directory names.
Next, modify the SQL statement to reference the new, shorter path. Always wrap paths that include spaces in single quotes and escape backslashes on Windows.
Automated ETL jobs often build date-partitioned directories such as /data/2024/06/12/export/long_service_name/
. Replace deep nesting with a flatter hierarchy or symbolic links.
When exporting using SELECT ... INTO OUTFILE, specify OUTFILE '/tmp/result.csv'
instead of a deeply nested project path.
Keep data-exchange directories close to root, for example /srv/mysql_in/
. Use concise naming conventions and avoid embedding UUIDs in path segments.
Monitor ETL scripts for path growth and set CI tests that reject filenames longer than 200 characters. Galaxy users can store parameterized paths in workspace variables for consistent reuse.
Error 1290 (HY000) – The MySQL server is running with the --secure-file-priv option so it cannot execute this statement. Unlike 2063, this is a server-side security restriction. Move the file under the secure-file-priv directory.
Error 2068 (CR_AUTH_PLUGIN_ERR) – A client authentication plugin problem; unrelated but often seen during initial connections before file operations.
The error is thrown by the client library, but it first appeared in MySQL 8.0.1. Older clients will not show code 2063.
MySQL delegates to the operating system. Most Unix variants allow 255 bytes per component and 4096 bytes per full path.
No parameter disables it. The only remedy is to shorten the path or file name.
Galaxy lets you centralize import/export directories via workspace variables and offers instant linting that flags overly long literals during query editing.