InnoDB fatal error cannot allocate memory for the buffer pool: Easy fix!
Are you looking forward to resolve the ‘InnoDB fatal error cannot allocate memory for the buffer pool’? We can help you in resolving it.
The error generally occurs due to some services taking up large amounts of memory(RAM).
At Bobcares, we often get requests from our customers to fix this error as part of our Server Management Services.
Today, let’s get into the details on how our Support Engineers fix this error.
Why InnoDB fatal error cannot allocate memory for the buffer pool error occurs?
InnoDB Buffer Pool is the memory space used by MySQL. It mainly holds many of its InnoDB data structures. This can be caches, buffers, indexes, and even row data.
The MySQL directive innodb_buffer_pool_size controls its value in the configuration file. This MySQL directive should be set with care if you want to improve the MySQL performance.
The InnoDB error indicates that the server runs out of memory.
However, we fix this either by lowering the user’s buffer pool size for something more suitable to the amount of RAM user’s droplet has, or we increase the RAM of customers droplet.
How we fix InnoDB fatal error cannot allocate memory for the buffer pool?
At Bobcares, where we have more than a decade of expertise in managing servers, we see many customers face problems with this.
Now, let’s see the major reasons for this error to occur and how our Support Engineers fix this error by tweaking the necessary parameters.
Changing configuration file using a smaller value
Recently one of our customers was facing a problem with MySQL. The service seems to be crashing quite often and MySQL was not starting.
We analyzed the reason for the problem by checking the MySQL logfile located at /var/lib/mysql/mysqld.log. From the error log we were now sure that MySQL failed at InnoDB: Initializing buffer pool.
We then opened the /etc/my.cnf configuration file.
Thereafter, we searched for the following directive.
innodb-buffer-pool-size = xxxM
Then we set the value of this directive to something lower(such as 50MB).
Finally, we restarted the MySQL service.
systemctl restart mysql
Finally, the error resolved.
Problem in Plesk
We also resolved the same problem for another customer who was having a Plesk server. The customer was not able to access Plesk and was getting the following error.
After analyzing the log file /var/log/mysqld.log, we got the following log.
The root cause of the problem was MySQL buffer size is bigger than free RAM available on the server.
We then connected to the server using SSH.
After that, we checked how much free RAM is available on the server.
So we set MySQL buffer pool size in /etc/my.cnf less than the amount of free RAM available:
Then we restarted MySQL service:
service mysqld restart
Hence, the error got eliminated.
[Need any further assistance with InnoDB errors? – We can help you with it]
In short, InnoDB fatal error cannot allocate memory for the buffer pool occurs mainly due to large amounts of memory usage. Today, we saw how our Support Engineers fixed this problem by altering the directive in the configuration file.