MySQL服务停止并无法启动的解决方法

MySQL无法启动服务并出现下面错误信息

service mysqld restart
Stopping mysqld:                                           [  OK  ]
MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]

定位查看日志内容 cat /var/log/mysqld.log

2019-10-09T05:08:19.265752Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-10-09T05:08:19.266335Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2019-10-09T05:08:19.266356Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2019-10-09T05:08:19.266365Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-10-09T05:08:19.266376Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-10-09T05:08:19.266383Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-10-09T05:08:19.266390Z 0 [ERROR] Failed to initialize plugins.
2019-10-09T05:08:19.266398Z 0 [ERROR] Aborting

2019-10-09T05:08:19.267794Z 0 [Note] Binlog end
2019-10-09T05:08:19.271292Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

这是因为物理内存不够引起的错误,解决方法很简单只需要修改MySQL的配置文件(位于/etc/my.cnf

[inonodb]
innodb_buffer_pool_size=64MB  #把这个数值改小 高版本的默认是128MB

Post Comment