Sometimes MySQL needs more open files than default value set for open_files_limit. In those cases, you can set the limit higher manually.
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 :
- Step 2 : Tell systemd to re-read the config files to apply the changes with the following command:
- Step 3 : Restart MySQL with the following command:
systemctl restart mysqld.service # RPM platforms
systemctl restart mysql.service # Debian platforms