Could not increase number of max_open_files to more than... (Solution)

Originally published at: Could not increase number of max_open_files to more than... (Solution)

A quick solution to the warning “Could not increase number of max_open_files to more than” when starting MySQL or MariaDB. For some background, read How MySQL Opens and Closes Tables. Here’s an excerpt: “The table_open_cache and max_connections system variables affect the maximum number of files the server keeps open. If you increase one or both of…

Today I had this issue on a Ubuntu 20.04 LTS server with MySQL 8.0.30 installed:

Could not increase number of max_open_files to more than 10000

I found the file here:


Also try:


I edited it to 100000:

Then ran:

systemctl daemon-reload
systemctl restart mysql

Updated the article to reflect this.

Just don’t forget to check if your distro uses BubbleWrap. When I got the error it turned out to be that instead and all I had to do modify a file to allow more namespaces. As per the bug in Debian I filed: “This is a more general Linux kernel parameter, not specific to bubblewrap, which affects bubblewrap and anything else that relies on Linux namespaces. Installing the bubblewrap package does not change it.
It might be set to 0 during boot by /etc/sysctl.conf, a file in /etc/sysctl.d, or a file in /usr/lib/sysctl.d, in which it’s referred to as “user.max_user_namespaces”.It might also be changed by some privileged program writing to /proc/sys/user/max_user_namespaces directly, or running the sysctl command.”

I asked: So what is the default for this with 8GB RAM?

Which I received this reply: “I don’t know specifically, but I’d guess slightly more than 30000 (it’s 63652 on a system with 16G RAM).” and I divided his setting by 2 and put that for a setting and haven’t had to mess with it since.

EDIT: Fixed formatting so it was readable.

1 Like

Thanks for adding this for those who will no doubt have that issue also.

I restarted MySQL today and noticed that the limit was reset. There’s probably a more tidy solution.

For now, I manually re-edited.

UPDATE: For permanent fix…

Use this command to setup an override

sudo systemctl edit m*.service 

Examples, choose one based on your system:
sudo systemctl edit mysql.service
sudo systemctl edit mysqld.service
sudo systemctl edit mariadb.service

Add the following:


Change to you the value you require.

Save and close the file.

Reload the systemd manager configuration:

sudo systemctl daemon-reload

Restart mysql or mariadb service:

sudo systemctl restart mysql