Thursday, 8 November 2018

MySQL going down due to insufficient memory

seems that our droplets doesnt have enogh memory some times and mysql cant allocate what it needs and crash, so we need to create a swap space to help this.
this is what I did:


On the command line
root@myserver:~# dd if=/dev/zero of=/swap.dat bs=1024 count=512k
root@myserver:~# mkswap /swap.dat
root@myserver:~# swapon /swap.dat
root@myserver:~# vim /etc/fstab
vim is started to edit, add the following to the end of /etc/fstab file
/swap.dat      none    swap    sw      0       0

Then, edit the mysql config file
root@myserver:~# vim /etc/mysql/my.cnf
And add this under [mysqld]
innodb_buffer_pool_size=64M

Finally reload mysql
root@myserver:~#  service mysqld reload

No comments:

Post a Comment