How to Fix MySQL Error 3683 (ER_BINLOG_EXPIRE_LOG_DAYS_AND_SECS_USED_TOGETHER)
You get mysql error 3683 when you set both days and seconds for log cleanup. Fix this error by using only the seconds option to manage binary log time limits. Database servers keep binary logs to track data changes and help with recovery. Over time, these log files grow large and fill up your storage disk. You must set up a clear rule to delete old logs on a schedule. When two cleanup rules clash, the database engine blocks the change and stops work. What causes mysql error 3683 in your 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 3683 when you set both days and seconds for log cleanup. Fix this error by using only the seconds option to manage binary log time limits.
Database servers keep binary logs to track data changes and help with recovery. Over time, these log files grow large and fill up your storage disk. You must set up a clear rule to delete old logs on a schedule. When two cleanup rules clash, the database engine blocks the change and stops work.
What causes mysql error 3683 in your database
The MySQL server uses the symbol ER_BINLOG_EXPIRE_LOG_DAYS_AND_SECS_USED_TOGETHER for this specific failure. It also returns the general SQLSTATE code HY000 to your client app. Older setups used a day count to decide when to purge binary logs. Newer setups use a second count to give teams finer control over storage.
The error message states that expire_logs_days and binlog_expire_logs_seconds cannot run together. If both values are active, the engine does not know which timer to trust. This clash often happens during version upgrades or when teams merge old server files. A user might also trigger it by changing one setting while the other stays active.
When this conflict occurs at startup, the database service may fail to start. If a team member sets it during a live session, the command fails right away. The server protects your data by refusing to guess your log retention rule.
How to find and fix the log expiration conflict
Start by checking your current global settings on the running database server. Look at the active values for both the day setting and the second setting. If the day setting has a non-zero number, you cannot update the second setting. You must clear the old day rule before you apply the new second rule.
Next, inspect the text files that load when the database server boots up. Search all server setup files for any lines that mention binary log retention. Remove the older day option from these files and keep only the seconds option. Convert your desired retention days into seconds so your storage plan stays the same.
MySQL Access Governance + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
To apply the fix on a live server, reset the day value to zero. Once the day value is zero, set your new retention time in seconds. Persist this change to your setup files so it survives the next server restart. Test the change on a staging instance before you touch your main production cluster.
How to prevent setup mistakes across your team
System errors often happen when too many people have full admin rights. Engineers might run quick fixes in production without checking existing server files first. You should limit who can change global settings on your active database instances. Give most users read rights or basic data roles for their daily tasks.
When a setting needs an update, route the request through a peer review step. Keep your database setup files in version control so you can track every edit. Automated checks can scan these files and block deprecated options before they go live. Clear access rules and peer reviews stop conflicting settings from reaching your servers.
You should also mask sensitive data like emails and phone numbers in query results. Masking rewrites matched fields in results so analysts can check logs without risk. Combining strict role limits with data masking keeps your database both stable and safe.
Inspect every MySQL query and response in flight
Static grants and network rules block bad logins. They cannot pause a risky query for review or mask emails in a result set. By design, hoop.dev sits inline in the MySQL protocol as a sidecar for your MySQL. For every plain query, prepared statement, or cursor an agent or human runs in production, hoop.dev decides to pass, mask, block, or hold it for review.
First, hoop.dev guardrails block banned actions before MySQL runs them, and an AI Analyzer you configure can score intent or escalate for approval. Next, hoop.dev data masking rewrites sensitive string columns in results in memory, and every verdict goes to the audit trail. Find the open-source binary on GitHub.
Frequently asked questions
What does SQLSTATE HY000 mean for this error?
HY000 is a general error code for issues that do not fit other groups. You must read the specific error number 3683 to know the exact cause.
Which binary log expiration setting should my team use?
Always use the binlog_expire_logs_seconds option for all modern MySQL setups. The official error message asks users to pick the seconds option over days.
Will fixing this error delete my current binary logs right away?
The server will delete old logs if your new time limit is shorter than before. Check your replication status before you lower the retention time on production servers.
Related guides
In this post