Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On my mac, after a fresh restart with zero connections, MySQL is currently using 40MB of memory, 188MB of virtual memory (on-disk database paged in?), and has 16 threads.

Since there's only ever one person accessing the server (me), and I don't hit it very often throughout the day, how can I configure MySQL to consume less memory when it's idle?

I don't mind it consuming as many resources as it needs to get queries done while they're executing, but would like to lower the footprint in between development sessions. Because of how the websites I work on function, it will only ever run one query at a time, maybe two simultaneous queries very occasionally.

I'm running MySQL on Mac OS X Server 10.7, using Oracle's official download, with no configuration changes.

40MB is usually fine, but lately I've been doing some non-MySQL development work that really does need every inch of memory my system has, and I'd rather not start/stop MySQL a few times each day.

share|improve this question
Since most databases try to read as much of their data into memory as possible to make it quicker, you're fighting a losing battle. Roland has some good ideas, but if you want to recycle the mysqld process, why not put it into a cron job? Also, RAM is so cheap now. – user3463 Jan 16 '12 at 4:37
Surely MySQL doesn't need to consume memory when its inactive? There cant be any caches filled - those figures are what it uses after starting up with zero queries ever executed. RAM is cheap but I only have so many slots, one of my current projects involves processing many tens of gigabytes of data. I know some vps companies have recommended configs for low memory servers, I'm looking for something similar. – Abhi Beckert Jan 16 '12 at 12:13

It depends on what storage engine your table are using.

If everything you use is MyISAM, can totally disable InnoDB as follows:

Step 01) Add this option to my.cnf


Step 02) restart mysql

By doing these two steps

  • mysqld starts faster
  • default InnoDB Buffer Pool (innodb_buffer_pool_size) is not created
    • 8M default before MySQL 5.5
    • 128M default starting with MySQL 5.5
  • With query_cache_type = 0, query cache is disabled
share|improve this answer
We have a few thousand clients, I need to be able to load any of their websites into my development server at any time. Many do use InnoDB. Is it possible to set the pool size to something smaller? – Abhi Beckert Jan 16 '12 at 12:09
MySQL is required to do so. Set innodb _buffer_pool_size to 4M in my.cnf – RolandoMySQLDBA Jan 16 '12 at 12:20
Sorry big typo : MySQL restart is required to do so. Set innodb _buffer_pool_size to 4M in my.cnf – RolandoMySQLDBA Jan 16 '12 at 21:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .