When the number of your end user is increasing, the original memory decreases. When you check mySQL log under /var/log/mysql/error.log, the following message shows:
2016-11-22 08:32:53 14506 [Note] InnoDB: Initializing buffer pool, size = 512.0M InnoDB: mmap(549453824 bytes) failed; errno 12 2016-11-22 08:32:53 14506 [ERROR] InnoDB: Cannot allocate memory for the buffer pool 2016-11-22 08:32:53 14506 [ERROR] Plugin 'InnoDB' init function returned error. 2016-11-22 08:32:53 14506 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2016-11-22 08:32:53 14506 [ERROR] Unknown/unsupported storage engine: InnoDB 2016-11-22 08:32:53 14506 [ERROR] Aborting
The error occurs because the server has insufficient memory to allocate for MySQL process.
To resolve the issue:
- Add memory to the machine by either adding a physical ram or increasing the memory size from hypervisor.
- Run the following command to check the swap:
sudo swapon -s
It shows one swap entry if the swap is enabled.Filename Type Size Used Priority /dev/mapper/single--installer--vg-swap_1 partition 8384508 0 -1
If it is disabled, run the following to enable swap:
sudo grep swap /etc/fstab | awk '{print $1}' | xargs swapon
- Reduce the allocation size of MySQL buffer pool from 512 MB to 64 MB.
sudo sed -i '/innodb_buffer_pool_size/c\innodb_buffer_pool_size = 64M' /etc/mysql/conf.d/safesync.cnf
- Restart MySQL service.
sudo service mysql restart