mysqllinuxmariadb

Could not increase number of max_open_files to more than 4096 (request: 4214)


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:

Link

Thank you in advance


Solution

  • This solution will fix your system but will wipe your data (full purge reinstall), so make sure you have backups available.

    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