The question was asked previously, "how do I calculate MySQL max_connections" and this was the answer:

max_connections = (Available RAM - Global Buffers) / Thread Buffers

Since I don't have enough reputation to add a comment to the existing question I had to ask a brand new question.

I can get the buffer values by executing : SHOW VARIABLES LIKE '%buffer%'; but what is the available RAM part of this equation exactly?

Is this value in bytes, kilobytes, megabytes? Something else? Also, do I use the available RAM shown in the resource monitor while my site is being used, or do I need to use the total amount of RAM installed on the machine?

4 Answers 4


I'd say 'Available RAM' means max memory mysql can claim. And 'Global buffers' would mean buffers like innodb_buffer_pool, key_buffer_size, query_cache_size, etc.

  • So in what format do I plug the available ram into the formula? Bytes, kilobytes, megabytes? Something else?
    – Vincent
    Oct 9, 2014 at 16:16
  • As long as you are consistent with the unit, you should arrive at same result. I'd go for MB. Oct 9, 2014 at 18:40

At this time you can use mysqlcalculator.com to assist with determining your RAM footprint in about 2 minutes if you have your SHOW GLOBAL VARIABLES; list available.


The default of 151 is a reasonable starting point. After running for some time, you may, but probably won't, see any problems. If you do have problems, any of several things could need tweaking -- including indexes on tables. max_connections rarely needs tweaking.

Bottom line: Don't fret over that one settings.


Hi When I give the values in the above formula, I am getting -ve DB Connections kindly adivice. Using 5.7 mysql

  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jun 14 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.