I have MariaDB + Nginx on Linux Debian 9(stretch).
After installing MariaDB it and trying to start it, I got the error saying:
[Warning] Could not increase number of max_open_files to more than 4096 (request: 4214)
.
So I googled it and it told me that I should change LimiNOFILE
to 10000 in /etc/systemd/system/mysql.service
. I did that, did deamon-reload and it did absolutely nothing. I am still getting the same error message. I tried reinstalling MariaDB but that didn’t help either. I also added LimitMEMLOCK=10000
at the very end of my file, that didn’t change anything.
Full traceback:
Thank you in advance
5
Answers
I solved it by reinstalling MariaDB with
And you should check if it's still on the system with:
And if it is, do:
But before doing that I killed everything that had to do with MariaDB/MySQL via
htop
. And then the standart procedure with installing it:It is not enough to change it at service level
You must also edit
And have these lines in them
Then,
And you could increase the number to 1000000 in limits.conf and mysql.service
Server settings like
openfile_files_limits
have no effect, if the operating system limits the number of open files, and will always result in an error. Since the server by default is running as user mysql, it can’t change the system values (and there is also no code in the server which changes these limits).Default value of open files on a Linux system is by default 1024, and can be determined by
So in case you have root privileges or you’re in the sudo’ers list, just increase this value.
man ulimit
will give you more information.Just noting the solution for me was to fix a bad config in the
tmpdir
variable. It was set to/mysqltmp
(probably because/tmp
was pretty small). I fixed it with:I am guessing setting
tmpdir
to a dir that doesn’t exist or has the wrong permissions triggers this message.It might be because of the limit set by the SystemD configuration file for the service. If that’s the case, you can solve it by editing
/usr/lib/systemd/system/mariadb.service
and increasing it to the requested value:… or wathever value you want:
open_files_limit won’t have any effect if the operating system or the init system has a lower limit for the user or service.