WP的buffer pool报错导致数据库Error的解决方法

首先查看错误日志

1
2
Cd /var/log
Tail -n 500 mysqld.log

发现错误是:

1
2
3
4
5
6
7
8
2018-11-11T09:08:20.364026Z 0 [Note] InnoDB: Initializing buffer pool, total size = 50M, instances = 1, chunk size = 50M
2018-11-11T09:08:21.751200Z 0 [ERROR] InnoDB: mmap(53690368 bytes) failed; errno 12
2018-11-11T09:08:21.751262Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2018-11-11T09:08:21.751274Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2018-11-11T09:08:22.220815Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2018-11-11T09:08:22.526092Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-11-11T09:08:22.526142Z 0 [ERROR] Failed to initialize builtin plugins.
2018-11-11T09:08:22.526159Z 0 [ERROR] Aborting

导致的 Wp Error establishing a database connection problem
解决方法:改mysql的设置

1
2
3
4
Where is my.cnf
Cd /etc
Vim my.cnf
innodb_buffer_pool_size = 50M

依然不行改swap空间
空间太小,设置swap分区

参考网址:
https://blog.csdn.net/Mr_OOO/article/details/78653523
http://junhey.com/2016/06/16/2016-06-17-05-10.html
https://www.cnblogs.com/LUO77/p/5821530.html

参考文件,这儿后面的就是在my.cnf可以直接修改23