MySQL 1211: Too many open files.

  1. Check the current open files limit for the MySQL process:


- Run `SHOW VARIABLES LIKE 'openfileslimit';` in MySQL to see the limit.

  1. Check how many files MySQL is currently using:


- Run `SHOW GLOBAL STATUS LIKE 'Open_files';` in MySQL.

  1. Increase the open files limit temporarily:


- If you have access and permissions, attempt to increase the limit for the running MySQL instance:
- Set in MySQL: `SET GLOBAL openfileslimit=limit>;` (replace `limit>` with the desired value).

  1. Check and close unused connections:


- Run `SHOW PROCESSLIST;` to see active connections and consider closing unused ones.

  1. Check the operating system limit:


- For Linux, run `ulimit -n` to see the maximum number of open file descriptors.
- Increase temporarily with `ulimit -n limit>` for the session, or permanently by editing `/etc/security/limits.conf` (for the specific user, add lines like `mysql soft nofile limit>` and `mysql hard nofile `).

  1. Restart MySQL Service (if possible and as a last resort after increasing limits):


- Use the command `sudo systemctl restart mysql` on Linux systems. Ensure that this action won’t cause unacceptable downtime for your applications.

  1. Check and adjust the `tableopencache` variable if necessary:


- First, see the current value: `SHOW VARIABLES LIKE 'tableopencache';`.
- Adjust if necessary: `SET GLOBAL tableopencache=;`.

Each action should be considered and performed based on the user's environment and with awareness of any potential impact on the system or service.

Master

MySQL

in Minutes — Grab the Ultimate Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Real-world configs/examples
Handy troubleshooting shortcuts
Your email is safe with us. No spam, ever.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

MySQL

Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Your email is safe with us. No spam, ever.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

MORE ISSUES

Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid