How to Fix MySQL Error 4002 (ER_DA_ERROR_LOG_TABLE_DISABLED)

Published
Length
3 min read

Luis Felipe Dias

All posts

You see mysql error 4002 when your database log sinks do not feed the performance schema. To fix it, add a log sink that writes error data to performance schema tables. MySQL sends error messages through a pipeline of log components. Some components write to text files on disk. Other components write rows into memory tables inside the performance schema. When no active component writes to memory tables, the server raises this alert. What causes mysql error 4002 in your database The server tr

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 see mysql error 4002 when your database log sinks do not feed the performance schema. To fix it, add a log sink that writes error data to performance schema tables.

MySQL sends error messages through a pipeline of log components. Some components write to text files on disk. Other components write rows into memory tables inside the performance schema. When no active component writes to memory tables, the server raises this alert.

What causes mysql error 4002 in your database

The server tracks this issue under symbol ER_DA_ERROR_LOG_TABLE_DISABLED and SQLSTATE code HY000. The official message says none of the selected log sinks support writing to the performance schema. Because of this gap, the server cannot populate the internal error log table.

Database admins often change global log error services to send logs to external files or JSON outputs. During these edits, teams sometimes remove the default internal sink by mistake. When that sink is missing, queries against the performance schema error log table return empty results.

This issue also happens when teams upgrade servers or copy old setting files to new hosts. Older setups might list only basic file outputs in their startup rules. The engine starts fine, but it warns you that memory table logging is off.

How to check your log sinks in production

Start by reading the current global log error services value on your database server. You do not need root host access to run a read check on system variables. A standard monitoring role can inspect active global variables through a safe database client.

Look at the list of active log components returned by your query. Check if the list contains only file writers or system log writers. If every listed component writes only to disk, you have found the root cause.

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

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You should also check if the needed log sink component is loaded into the server. Sometimes a team loads a JSON writer but forgets to keep the internal sink active. Comparing your test server settings with production settings helps spot missing items fast.

How to fix the error and restore table logging

To fix the problem, update the global log error services list to include a sink that writes to the performance schema. MySQL lets you chain multiple log sinks together in one setting. This means you can keep your custom file logs and still populate the performance schema table.

Apply the change through your standard database change process rather than ad hoc admin sessions. First, load any missing sink component if it is not yet active in the engine. Next, update the global log error services variable so it lists both your file sink and the internal table sink.

Make sure you also save this updated rule to your persistent server settings file. If you only change the variable in memory, the fix will vanish after the next restart. Once you save the rule, run a quick query on the performance schema error log table to confirm new events appear.

Keep permissions tight while you apply this fix. Engineers do not need broad data read rights to update log pipeline rules. Grant only the specific system variable permissions needed for the task, and log every admin query for your audit trail.

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

Does mysql error 4002 stop the database from running?

No, the database engine keeps running and serving queries. The code warns you that the performance schema error log table will not receive new log rows.

Can I use file logs and performance schema logs at the same time?

Yes, you can list multiple log sinks in the global log error services setting. The server sends each log event to every sink in your active pipeline.

Why did my performance schema error log table stop showing new rows?

Someone removed the performance schema sink from the global log error services variable. Adding that sink back to the pipeline restores logging to the memory table.

The query runs. The emails stay hidden.