环境
Linux version 4.18.0-147.5.2.1.h579.eulerosv2r10.x86_64 (abuild@szxrtosci10000) (gcc version 7.3.0 (GCC)) #1 SMP Sat Jul 31 09:58:46 UTC 2021
mysqld 8.0.28
问题
mysql运行一段时间后,报错
2022-03-14T10:55:39.841075Z 0 [Warning] [MY-012681] [InnoDB] page_aligned_alloc mmap(137170944 bytes) failed; errno 12
2022-03-14T10:55:39.841217Z 1 [ERROR] [MY-012956] [InnoDB] Cannot allocate memory for the buffer pool
2022-03-14T10:55:39.841288Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2022-03-14T10:55:39.841386Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-03-14T10:55:39.841636Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-03-14T10:55:39.841797Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-03-14T10:55:39.844824Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.28) MySQL Community Server - GPL.
解决方案
调整innodb_buffer_pool_size参数 编辑 my.cnf文件
vim /etc/my.cnf
在 [mysqld] 下增加
innodb_buffer_pool_size = 64M
重启
systemctl restart mysqld
查看 连接到数据,使用查询语句
SELECT @@innodb_buffer_pool_size/1024/1024;
其他系统解决方案
增加swap交换空间
dd if=/dev/zero of=/swapfile bs=1M count=1024
mkswap /swapfile
swapon /swapfile
增加自动挂载: 在文件/etc/fstab中加入 /swapfile swap swap defaults 0 0
查看
free -h
重启数据库
systemctl restart mysqld
|