Mysqld.exe Process Taking Too Much RAM in WAMP?

If you find that mysqld.exe in Windows with WAMPSERVER is using a lot of RAM, this may help.

I have WAMPSERVER 2.4 installed with MySQL 5.6.12 as you can see here:



The mysqld.exe process is taking almost 500MB of RAM!



This has to do with a high default on the table_definition_cache variable of MySQL. Note that this variable may not have an entry in your my.cnf or my.ini file. Mine did not have an entry for this variable. However, when I checked the active variables using Navicat, it shows a value of 1400 as you can see here:



According to dev.mysql, the default value of MySQL 5.6 is 400. You can see here that it is actually a calculated value:

Notice that it says the value is based on a formula:

400 + (table_open_cache / 2)

So my table_open_cache is also not set in my.ini. My value happened to be at 2000. That answers that question. So why is table_open_cache so high? According to mysql, for MySQL version 5.6.12 or greater the default is 2000. There is the answer! I just happen to have installed MySQL 5.6.12 which set a table_open_cache of 2000 which, when using the calculation above set the table_definition_cache to 1400, which then used up about 500MB of RAM.

For my fix, I just added table_definition_cache = 400 to my.ini and restarted MySQL. Now it takes about 95MB of RAM.

My use of WAMP is fairly light, however, if you use yours heavily or keep a ton of data, you might fine tune these values to be more appropriate to your needs. Now I have a small table_definition_cache but still have a high table_open_cache. This may or may not cause issues in the future, but for now it’s just fine for a single user like me.

Hope that helps!