Tag Archives: debian

MySQL Crashing and Debian Open File Limit

For a while, I had issues with my MySQL server crashing. It was simple enough to just restart the server, but that started to get tedious. So, I finally decided to try to figure out what the root problem was. I started with the MySQL error log. There were several tables that were marked as crashed. The storage engine for the crashed tables was MyISAM, so I switched them over to InnoDB. There were a few other errors and warnings to clean up. The biggest issue I had though, was:

[Warning] Buffered warning: Could not increase number of max_open_files to more than 1024 (request: 5000)

MySQL could not open the number of files it requested. I needed to increase the ulimit for the server. You can do this on a per user basis, so I actually only increased the limit for the mysql user. I restarted the MySQL server, but continued to see the warning in the error log. Running a quick ulimit -HSn showed the same default limit. My changes did not take effect. After a lot of researching, I came across this answer on Stack Exchange, which refers to a bug in Debian, and needing to add additional configuration/etc/pam.d/common-session. After following these instructions, and restarting the MySQL server again, I no longer receive the warning in my error log, and running ulimit -HSn shows the correct configuration. I’m happy to say that my MySQL server has been up for over a week now, which would indicate my problem is fixed (for now).

Posted in Server | Also tagged | Leave a comment