I am currently stress testing my PHP, MySQL application hosted on AWS EC2 using Amazon Linux. After reaching certain number of users DB starts to give error: Can't create a new thread (errno 11); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug. There is still a lot of memory free on my system which I can see with free -m when i get this error.

I have tried to change limits for mysql in /etc/security/limits.conf but with no success. What else can I try? How can I reach to root of the issue? And yes, I am new to MySQL and Linux.

Update: After answer of jeffatrackaid I have tried adding a config file in directory /etc/security/limits.d named 99-mysql.conf but the error still persist. Following is the content of the file:

mysql  soft   nproc   20960
mysql  hard   nproc   45960
mysql  soft   nofile   20960
mysql  hard   nofile   45960
root   soft   nproc    20960
root   hard   nproc    45960
root   soft   nofile   20960
root   hard   nofile   45960

Update: Worked after system reboot.


You are on the right track but in some newer OS's (e.g. CentOS 6), there is a:


That will override items put in limits.conf.

I recommend putting a higher number file (e.g. 99-mysql.conf) in here with your limits.

For more See: http://www.mysqlperformanceblog.com/2013/02/04/cant_create_thread_errno_11/

  • 1
    I tried it out but the error is still there. Updated question to include that info. May 21 '13 at 6:30
  • Assure mysql has a shell and su - to that shell. See what limits it has. May 21 '13 at 15:32
  • Hmm... I did su into mysql with sudo su mysql and ran ulimit -n and it returned 20960 which is correct. Don't know why it is still not helping with the error. May 22 '13 at 4:16
  • Well it is working now. All it needed was a system reboot. :) May 23 '13 at 11:34
  • Yes the limits are applied during the init script during boot. However when you restart a service at the command line the user's limits are used. May 23 '13 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.