setting ulimit and ubuntu 8.04

[edit: explained details for clarity]

I suspect you checked the ulimit for the different user than mysql ;)

You don't have to reboot after changing limits.conf. You have to turn on use of this file in the corresponding PAM service in /etc/pam.d/.

Do grep pam_limits /etc/pam.d/* to have a clue in which situation limits.conf will be used.

For example, change in limits.conf for can be visible in the shell invoked as sudo -u user bash but doesn't when run as sudo su - user - that's because on Ubuntu default setting goes like this:

$ grep limits /etc/pam.d/*|grep su
/etc/pam.d/su:# session required pam_limits.so
/etc/pam.d/sudo:session required pam_limits.so

So if you checked limits using sudo su - mysql then there was a mess -- su didn't turn the limits on. You can check which pam service is being run by watching /var/log/auth.log.

For all possible types of invocation of your mysql it should be safe to modify pam.d/other or just pam.d/common-session.


A more straightforward way (and kinda of a hack) is just add the ulimit -n 8192 command inside the init script for mysql /etc/init.d/mysql. The control is valid for the shell and the child processes/shells that it opens.

EDIT: the su and sudo 'weirdness' is because the limits.conf file is related to PAM limits that, if I am not mistaken, only applies to login shells. Also, there is some info on start-stop-daemon being unable to use the pam limits.