How to Fix MySQL Error 1135 (ER_CANT_CREATE_THREAD)
You see mysql error 1135 when the host system cannot start a new database thread. You fix it by raising OS process limits, freeing host memory, or pooling app sessions. The official symbol for this failure is ER_CANT_CREATE_THREAD, and it uses SQLSTATE HY000. The server message states that it cannot create a new thread and shows an OS number. When this happens, the database rejects new logins and stops background tasks from starting. Teams must inspect both the database engine and the host kern
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 1135 when the host system cannot start a new database thread. You fix it by raising OS process limits, freeing host memory, or pooling app sessions.
The official symbol for this failure is ER_CANT_CREATE_THREAD, and it uses SQLSTATE HY000. The server message states that it cannot create a new thread and shows an OS number. When this happens, the database rejects new logins and stops background tasks from starting. Teams must inspect both the database engine and the host kernel to stop the outage.
What causes mysql error 1135 in production
Every incoming client session needs a dedicated thread from the underlying operating system. When a user logs in, the database asks the host kernel for a new thread. If the kernel denies that request, the database returns this error right away.
Memory exhaustion is the first common trigger on busy database hosts. Each new thread needs a small slice of RAM for its stack space. If the server runs out of free RAM, the kernel blocks new thread creation. High memory buffers inside the database can also starve the host system of free RAM.
Operating system user limits are the second major cause of this failure. Linux hosts restrict how many processes and threads a single system user can run. Even when the box has plenty of RAM, the database user hits this ceiling. Once the thread count reaches the limit, the kernel refuses to spawn more threads.
Sudden traffic spikes or broken client pools also push thread counts over the edge. Apps that open new sessions without closing old ones drain host resources fast. Human users running ad-hoc queries from desktop tools add extra load during peak hours. Without strict limits on idle sessions, the thread count grows until the server locks up.
How to diagnose and fix the thread limit safely
Start your check by looking at the system error number inside the database log. That number tells you if the host lacked memory or hit a user limit. Check the host memory stats and current process count for the database service account.
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 fix this issue by giving the database root rights on the host. Also avoid setting process limits to unlimited, since that risks a full host crash. Instead, raise the thread cap for the database service account to a safe number. Make sure this number matches the physical RAM available on your host machine.
Next, tune the thread cache inside the database engine so it reuses idle threads. Reusing existing threads stops the database from asking the kernel for new ones on every login. You should also lower the wait timeout so the engine drops dead sessions faster.
Finally, put a session pool between your apps and the database server. A pool keeps a small set of open threads and shares them across many requests. You should also control how engineers and scripts run ad-hoc queries against production hosts. Routing human and automated sessions through a central point prevents sudden thread spikes. While doing this, data masking can rewrite emails, phone numbers, card numbers, and national IDs in results.
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_CANT_CREATE_THREAD mean in MySQL?
ER_CANT_CREATE_THREAD is the official symbol for error 1135 under SQLSTATE HY000. It means the host operating system refused to give the database a new thread.
Can error 1135 happen when the server still has free RAM?
Yes, this happens often when the Linux user account hits its process limit. The kernel blocks new threads even when plenty of free system memory remains.
How do I stop apps from triggering error 1135 during traffic spikes?
Use a session pool to cap the total number of active database threads. Also set short idle timeouts so the database closes unused client sessions right away.
Related guides
In this post