skip to Main Content

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

5

Answers


  1. Chosen as BEST ANSWER

    I solved it 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

    But before doing that I killed everything that had to do with MariaDB/MySQL via htop. And then the standart procedure with installing it:

    $ sudo apt update

    $ sudo apt install mariadb-server

    $ sudo mysql_secure_installation


  2. 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

    Login or Signup to reply.
  3. 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.

    Login or Signup to reply.
  4. 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.

    Login or Signup to reply.
  5. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search