How to Increase MySQL Memory Usage Above 2GB

MySQL is a great database server for small, medium, and large websites, but large sites may find that the database alone can consume a great deal of system resources.  Ideally, you should be able to increase resources (i.e. more processors and more memory) in order to get better performance.  In reality, however, there are some limitations.

If you find that MySQL will only use 2GB of your RAM even though you have 6GB,8GB, or even more available, there are a couple of things you should do.

First, check your server’s hardware architecture and the architecture of your operating system.  If your server has 32-bit architecture, it does not matter how many processors or memory sticks you add, MySQL will have a 2GB limit.

With such a large site, however, it is not likely that you have an enterprise class server that does not have 64-bit processors.  In all likelihood, it may just be your Linux-based operating system that is the 32-bit version.  If that is the case, you could reinstall the 64-bit version or, more easily, install a PAE kernel.  PAE stands for Phystical Address Extension and will allow your OS to access a physical address space higher than 4GB.  Linux distributions such as CentOS have PAE kernels available in their software repositories.