You are invited to Log in or Register a free Frihost Account!

Hack to fix when MySQL crashes on Linux servers

I have not had any issues with MySQL on an amazon ec2 instance until one client of mine had a website that kept crashing. I located the MySQL log file and kept seeing the following fatal error:

Fatal error: cannot allocate memory for the buffer pool…

There were other errors, but a fatal error is the one I wanted to look into first as it is the one stopping the server.

Here is how I solved this issue. I hope it helps someone with a similar problem:

First, it is always a good idea to back up your MySQL databases on the server in case something goes wrong.

I also tried deleting any unused databases, tables and data to allow for more disk space as that seemed to be an issue. However, after doing so, I checked the memory available on the webserver by issuing a df command from the command prompt and found that there was clearly plenty of space available before and after deleting the data from the databases. Therefore this was not apparently my issue. Logic brought me to thinking that if there was plenty of disk space and there was still an error related to memory, there may be something wrong with the swap. I came to discover that the micro instance I was using didn’t have a swap space and that was cause for alarm because as far as I know, swap is needed to initialize the database engines.

Please follow the following link to my tutorial on how to add swap space to a Linux amazon ec2 instance if you are having similar issues. This should work on any Linux web server by the way:

1 blog comments below

BACKUP Exclamation dude, u know; anything not in the correct synthax or in a pratical disorder can cause a crash, whats a crash an error that stumbles the system from operating, that the way in game development That why THeY call for the SAW !!!! i mean the debuging :/ lol @ the SAW xDDDDDD

PS: i dont even know what does stumble means but i ll address it as "stops"
CHAOS-THEORY on Tue May 14, 2013 6:31 pm

© 2005-2011 Frihost, forums powered by phpBB.