MySQL:低内存机器配置:修订间差异

来自WHY42
imported>Soleverlee
(以“这几天发现本网站老是连不上数据库,查看日志: <pre> 170110 8:29:52 InnoDB: Initializing buffer pool, size = 128.0M InnoDB: mmap(137756672 bytes...”为内容创建页面)
 
imported>Soleverlee
无编辑摘要
 
第21行: 第21行:
performance_schema = off
performance_schema = off
</source>
</source>
 
另外查看EC-2没有设置swap,需要设置swap:
<source lang="bash">
dd if=/dev/zero of=/swapfile bs=1M count=1024
mkswap /swapfile
swapon /swapfile
</source>
添加到/etc/fstab
<pre>
/swapfile swap swap defaults 0 0
</pre>
如果需要更改innodb_buffer_pool_size
<source lang="lua">
[mysqld]
innodb_buffer_pool_size=64M
</source>
[[Category:Database]]
[[Category:Database]]

2017年1月12日 (四) 02:10的最新版本

这几天发现本网站老是连不上数据库,查看日志:

170110  8:29:52 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137756672 bytes) failed; errno 12
170110  8:29:52 InnoDB: Completed initialization of buffer pool
170110  8:29:52 InnoDB: Fatal error: cannot allocate memory for the buffer pool
170110  8:29:52 [ERROR] Plugin 'InnoDB' init function returned error.
170110  8:29:52 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
170110  8:29:52 [ERROR] mysqld: Out of memory (Needed 128917504 bytes)
170110  8:29:52 [ERROR] mysqld: Out of memory (Needed 96681984 bytes)
170110  8:29:52 [ERROR] mysqld: Out of memory (Needed 72499200 bytes)
170110  8:29:52 [Note] Plugin 'FEEDBACK' is disabled.
170110  8:29:52 [ERROR] Unknown/unsupported storage engine: InnoDB
170110  8:29:52 [ERROR] Aborting

正巧本人使用的就是AWS的免费EC2服务器,还有MariaDB。修改配置

[mysqld]
performance_schema = off

另外查看EC-2没有设置swap,需要设置swap:

dd if=/dev/zero of=/swapfile bs=1M count=1024
mkswap /swapfile
swapon /swapfile

添加到/etc/fstab

/swapfile swap swap defaults 0 0

如果需要更改innodb_buffer_pool_size

[mysqld]
innodb_buffer_pool_size=64M