InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137756672 bytes) failed; errno 12
InnoDB: Fatal error: cannot allocate memory for the buffer pool
[ERROR] Out of memory (Needed 128917504 bytes)
free -m 顯示 Swap = 0,物理內存不足且無交換分區是直接原因。
dd if=/dev/zero of=/swapfile bs=1024 count=1048576
mkswap /swapfile
swapon /swapfile
/etc/fstab 追加
/swapfile swap swap defaults 0 0
free -m 或 cat /proc/swaps 顯示 1023M Swap 可用。在 /etc/my.cnf [mysqld] 區添加:
innodb_buffer_pool_size = 64M
performance_schema = OFF
table_open_cache = 200
systemctl start httpd.service
systemctl start mariadb.service
網站恢復正常訪問。
tail -f 定位 OOM/權限/磁盘滿等硬傷