How to Fix MySQL Error 1085 (ER_TEXTFILE_NOT_READABLE)
You get mysql error 1085 when the database engine cannot read a target text file. To fix it, move the file to the database folder or update its read permissions. This problem stops bulk data loads cold. It happens when you run a data import task from the server disk. MySQL returns SQLSTATE HY000 and the symbol ER_TEXTFILE_NOT_READABLE. The error message states that the file must be in the database directory. It also says the file can be readable by all users instead. Understanding how the datab
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You get mysql error 1085 when the database engine cannot read a target text file. To fix it, move the file to the database folder or update its read permissions.
This problem stops bulk data loads cold. It happens when you run a data import task from the server disk. MySQL returns SQLSTATE HY000 and the symbol ER_TEXTFILE_NOT_READABLE. The error message states that the file must be in the database directory. It also says the file can be readable by all users instead. Understanding how the database process reads local files helps you solve this fast.
What causes mysql error 1085 in your database
The database server runs under its own operating system user account. When you ask the engine to load a text file, that system user tries to open it. If the file sits in a private user folder, the database user hits a wall. Linux and Windows permissions block the database from reading private folders.
Parent folders also cause this error. Even if the text file is open to everyone, a locked parent folder blocks the path. The database process needs execute rights on every folder in the full path. Without those rights, the engine cannot reach the file to read it.
Server security tools on Linux can also trigger this error code. Tools that lock down system processes often restrict where the database can look. Even when normal file permissions look fine, these security profiles block outside folders. The engine only trusts its own data directory by default.
How to diagnose and fix the file permission failure
Start by checking the exact file path in your import request. Make sure the file is on the database server and not only on your laptop. Next, check the permissions of the file and every folder above it. If the file sits in a home folder, move it out right away.
The safest fix is moving the text file into the designated database directory. You can check your server settings to find the exact path for safe file imports. When you put the file in that trusted folder, the database user can read it. You do not need to open up wide permissions across your whole server.
MySQL Access Governance + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
If you cannot move the file, change who owns it on the disk. Set the file group to match the database system group. Then give that group read rights on the file and traverse rights on the folder. Avoid making sensitive files readable by all users on a shared host.
Safer ways to handle bulk text imports
Giving everyone read access to data files creates a big risk. Those text files often hold raw customer data like emails, phone numbers, or card numbers. If any user on the host can read the file, your data is at risk. Keep strict folder permissions and clean up import files once the job finishes.
You can also run the import from the client side instead of the server disk. Client imports send the file stream through your database session. This approach skips server disk permissions, though you must still watch your network rules. Strong access controls and data masking rules help keep these imports safe. Masking rewrites matched fields in results so teams work safely with sensitive tables.
Check MySQL queries and results on the wire
MySQL grants control who logs in. They do not check single queries or mask sensitive columns once a session starts. With hoop.dev, you run an open-source proxy, a sidecar for your MySQL, inline in the MySQL wire protocol. On every query an AI agent or human runs against production MySQL, RDS, or Aurora, hoop.dev decides to pass, mask, block, or hold it for review.
Multi-statement batches and prepared queries are split and checked one by one by hoop.dev guardrails, which refuse banned queries with a native MySQL error or hold risky ones for approval. On the response path, hoop.dev data masking rewrites string values in returned rows in memory, and every decision is logged. See the MIT-licensed project on GitHub.
Frequently asked questions
What does ER_TEXTFILE_NOT_READABLE mean in MySQL?
It means the database server process lacks the operating system rights to open your text file. The error uses code 1085 and SQLSTATE HY000 when a bulk file load fails.
Why does the error happen when the file is already readable by all?
A parent folder in the file path likely blocks the database user. The database account needs permission to pass through every folder leading to the file.
Is it safe to make my import files readable by all users?
No, making files readable by all exposes raw data to other accounts on that server. Instead, place the file in the designated database directory and restrict access to the database group.
Related guides
In this post