欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

vps mysql自动关闭

程序员文章站 2022-03-23 20:33:30
...
mysql自动关闭

买了个阿里云的vps 装了一个wordpress,mysql一直自动关闭,百思不得其解,只有搜索

最后才发现是因为服务器内存太小,毕竟是最便宜的才512m

-----------------------------------------------------

InnoDB: mmap(137363456 bytes) failed; errno 12

140521 1:53:50 InnoDB: Completed initialization of buffer pool

140521 1:53:50 InnoDB: Fatal error: cannot allocate memory for the buffer pool

140521 1:53:50 [ERROR] Plugin 'InnoDB' init function returned error.

140521 1:53:50 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

140521 1:53:50 [ERROR] Unknown/unsupported storage engine: InnoDB

140521 1:53:50 [ERROR] Aborting

140521 1:53:50 [Note] /usr/sbin/mysqld: Shutdown complete

-----------------------------------------------------

没有100M的空间给他使用,修改/etc/mysql/my.cnf

增加

[mysqld]

innodb_buffer_pool_size=8MB

保存后,再启动mysql

mysql -u root -p

进入mysql

输入

show variables like'%buffer_pool%';

看到

+------------------------------+---------+

| Variable_name | Value |

+------------------------------+---------+

| innodb_buffer_pool_instances | 1 |

| innodb_buffer_pool_size | 8388608 |

+------------------------------+---------+

说明成功了,这样就不会重启了,话说512m的内存真可怜。