Reputation: 159
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
Upvotes: 7
Views: 36928
Reputation: 159
I solved it by first killing everything that had to do with MariaDB/MySQL via htop
and then by reinstalling MariaDB with
$ sudo apt-get purge mariadb-server
And you should check if it's still on the system with:
$ sudo dpkg -l | grep mariadb
And if it is, do:
$ sudo apt-get purge mariadb-common
And then the standard procedure of installing it:
$ sudo apt update
$ sudo apt install mariadb-server
$ sudo mysql_secure_installation
Upvotes: 5
Reputation: 1114
In my case, I had a syntax error in the MySQL config file: my.cnf
after removing the error line, I started MySQL service successfully.
Upvotes: 0
Reputation: 61
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:
LimitNOFILE=4214
... or wathever value you want:
LimitNOFILE=100000
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.
Upvotes: 6
Reputation: 1
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:
mkdir -p /mysqltmp
chown mysql.mysql /mysqltmp
I am guessing setting tmpdir
to a dir that doesn't exist or has the wrong permissions triggers this message.
Upvotes: 0
Reputation: 7516
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
$> ulimit -n
1024
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.
Upvotes: 0
Reputation: 49393
It is not enough to change it at service level
You must also edit
/etc/mysql/conf.d/limits.cnf
And have these lines in them
[mysqld]
open_files_limit = 10000
Then,
service mysql restart
And you could increase the number to 1000000 in limits.conf and mysql.service
Upvotes: 3