WSL does not have systemd
. That is why your changes from /etc/systemd/system/mysqld.service.d/limits.conf
are not applied. So ulimit -n
returns 1024
.
You can edit the /etc/security/limits.conf
file in order to increase the limits for every user by appending the following lines:
* soft nofile 10000
* hard nofile 10000
By restarting mysql
service, the above file is read an applied. In order to restart mysql
service execute:
sudo service mysql restart
The limits will be changed for user mysql
. To check this you can run the command:
ps -ef|grep -e ^mysql
mysql 90 1 0 18:28 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe
mysql 250 90 0 18:28 ? 00:00:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --log-error=/var/log/mysql/error.log --pid-file=statie-ac-0027.pid
for pid in `ps -ef|grep -e ^mysql|awk '{print $2}'` ; do echo pid=$pid user=`ps -ef|awk '{if( $2 == '$pid' ) print $1}'`; sudo prlimit -p $pid --nofile ; done
pid=90 user=mysql
RESOURCE DESCRIPTION SOFT HARD UNITS
NOFILE max number of open files 10000 10000 files
pid=250 user = mysql
RESOURCE DESCRIPTION SOFT HARD UNITS
NOFILE max number of open files 10000 10000 files
P.S.
It seems that for the normal user we have the same status (no change read for no file limit) because by default no login is executed. But if you run:
su <username>
then the limit files are read and ulimit -n
will return 10000
also for the current user.
P.P.S.
My answer was inspired by: