MySQL 1164: Server out of memory.

  1. Check Current Memory Usage: Run `SHOW ENGINE INNODB STATUS;` to check the InnoDB memory allocation.



  1. Identify Large Queries: Execute `SHOW FULL PROCESSLIST;` to identify any long-running or large queries that might be consuming excessive memory.



  1. Optimize Problematic Queries: Use the information from the previous step to optimize or kill any problematic queries. To kill a query, use `KILL [query ID];`



  1. Clear Query Cache: If query cache is enabled, clear it by executing `FLUSH QUERY CACHE;`



  1. Check Table Locks: Run `SHOW OPEN TABLES WHERE In_use > 0;` to identify if there are any tables locked, consuming memory.



  1. Reduce Memory Usage: Temporarily reduce the `innodbbufferpoolsize` (if it's set very high) to free up some memory. Use `SET GLOBAL innodbbufferpoolsize = [desired size];` Make sure to adjust this to a safe value that won't impact your system's performance negatively.



  1. Restart MySQL Service: If possible and as a last resort, restart the MySQL service to clear the memory. Use your system's service management commands for this, such as `sudo systemctl restart mysql` on Linux.



8. Check Error Log: Finally, check the MySQL error log for any additional clues. The location of the log file varies but can often be found in `/var/log/mysql/error.log` or by running `SHOW VARIABLES LIKE 'log_error';`

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