WordPress的MySQL连接自动关闭

前段时间,Wordpress总是运行一段时间就连接不上MySQL了,只给出了提示: Error establishing a database connection

登录服务器查看状态,MySQL已经挂掉了,只能以root权限重启才可以。

后来Google一下,发现是服务器内存太小的缘故。我使用的是AWS的T1实例,内存很小(512M,免费的要求别太高了),导致MySQL分配不到更多的内存去运行。

修复方式如下:

  1. 修改/etc/mysql/my.cnf,新增一条:innodb_buffer_pool_size=8MB
  2. 重启MySQL

登录MySQL后输入命令:show variables like’%buffer_pool%’;如果显示以下信息:

innodb_buffer_pool_size | 8388608

表示修改配置已经成功。

Leave a Comment

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax