buy
How To Increase max_open_files for MySQL

Overview

Sometimes MySQL needs more open files than default value set for open_files_limit.  In those cases, you can set the limit higher manually.

Procedure

File to edit limits is limits.conf which is located at :

For Ubuntu distribution : /etc/systemd/system/mysql.service.d/limits.conf.

For CentOS distribution : /etc/systemd/system/mysqld.service.d/limits.conf.

If the files is not already present then create it.

  • Step 1 : Edit the file limits.conf

You can manually open the file or you can also edit file with the following command:
systemctl edit mysqld
  # RPM platforms
systemctl edit mysql    # Debian platforms

For example :
[Service]
LimitNOFILE=50000

  • Step 2 : Tell systemd to re-read the config files to apply the changes with the following command:

systemctl daemon-reload

  • Step 3 : Restart MySQL with the following command:

systemctl restart mysqld.service   # RPM platforms
systemctl restart mysql.service       # Debian platforms

    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list