Linux – Error with MySQL server: Can’t create a new thread (errno 11)

linuxmemoryMySQL

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.

Best Answer

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

/etc/security/limits.d/

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/