July 24, 2014
NFTeam
MySQL keep crashing on EC2 instance

AMAZON EC2 INSTANCE TRICKS

Amazon EC2 micro instances have only 612MB of memory and do not have default SWAP space and this is reason mySQL crashes for insufficient memory. This can be avoided adding a swap space.

dd if=/dev/zero of=/swapfile bs=1M count=1024
mkswap /swapfile
swapon /swapfile

If you would like to automatically enable swap file after each reboot, add following line to /etc/fstab

/swapfile swap swap defaults 0 0

AWS, EC2, micro, instance, mysql, WordPress