How to Fix MySQL Error 3948 (ER_CLIENT_LOCAL_FILES_DISABLED)

Published
Length
3 min read

Luis Felipe Dias

All posts

You get mysql error 3948 when a query tries to load a local file while local data loading is off. To fix it, you must turn on local file loading on both the client and the server. MySQL maps this issue to symbol ER_CLIENT_LOCAL_FILES_DISABLED and SQLSTATE 42000. The engine returns the message that loading local data is disabled on your system. It stops the file transfer right away to protect your database. Why mysql error 3948 happens in your database MySQL blocks local file imports by defau

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 3948 when a query tries to load a local file while local data loading is off. To fix it, you must turn on local file loading on both the client and the server.

MySQL maps this issue to symbol ER_CLIENT_LOCAL_FILES_DISABLED and SQLSTATE 42000. The engine returns the message that loading local data is disabled on your system. It stops the file transfer right away to protect your database.

Why mysql error 3948 happens in your database

MySQL blocks local file imports by default to stop bad actors from reading private host files. When a user runs a local data load, the server asks the client to send the file. If a rogue server asks for a file, a weak client might send private system data.

To prevent this leak, the database engine checks two separate security switches before moving data. First, the server must allow local file imports in its global rules. Second, the client app or tool must also agree to send local files during that session.

If either side says no, the engine stops the job and throws mysql error 3948. Many teams hit this roadblock after a database upgrade or a driver update. Modern drivers turn off local file access out of the box to keep your systems safe.

How to check and fix the error safely

Start by checking the server rule to see if the database allows local data loads. An admin can query the global system state to see if local file loading is on. If it is off, you can turn it on for the active server session.

Next, check the client tool or app driver that runs the import job. Even when the server allows local files, the client must also turn on this option. Update your client connection properties so the tool permits local file transfers for that task.

MySQL Access Governance + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Do not leave global local file loading turned on all the time in production. Keeping it on across the whole cluster creates a wide security gap for all users. Instead, turn the server rule on right before a trusted import job and turn it off after.

Safer ways to load data in production

In many cases, you can skip local client file loads and use server staging instead. Move the raw data file to a dedicated folder on the database host first. The database server restricts file reads to that single trusted folder path.

This method keeps client file transfers turned off while still letting teams import bulk data. You should also limit which database roles have permission to run bulk file loads. Only dedicated data pipeline roles or admin accounts should hold file load privileges.

When teams run bulk loads or check import rows, keep an eye on sensitive data. Dynamic data masking can rewrite matched fields like emails, phone numbers, card numbers, or national IDs in results. Every query and import step should also write to a central audit log for review.

Add wire guardrails and masking beside MySQL

Database grants and TLS setup decide who can reach MySQL. Even so, an open session can run broad updates or read raw personal data from allowed tables. In practice, hoop.dev sits inline in the wire protocol beside the database as a sidecar for your MySQL. On every production query an agent or engineer sends, hoop.dev decides to pass, mask, block, or escalate it for human review.

With hoop.dev MySQL support, guardrails refuse bad queries before they run or hold risky calls for approval, while data masking rewrites matched sensitive values in result rows in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for GDPR, HIPAA, and PCI DSS programs. Read the docs and source on GitHub.

Frequently asked questions

What does ER_CLIENT_LOCAL_FILES_DISABLED mean in MySQL?

It means your query tried to load a local file while local file loading is turned off. MySQL uses code 3948 and SQLSTATE 42000 for this error when client or server rules block the load.

Why did this error appear after updating my client driver?

Newer MySQL client drivers turn off local file sending by default to improve security. Even if your server allows local files, you must enable the setting in your updated client driver.

Is it safe to enable local file loading permanently?

No, leaving local file loading on all the time exposes client files to untrusted servers. Turn it on only for specific, trusted import sessions, or load files from a restricted server folder instead.

The query runs. The emails stay hidden.