手机
当前位置:查字典教程网 >编程开发 >mysql数据库 >mysqld-nt: Out of memory (Needed 1677720 bytes)解决方法
mysqld-nt: Out of memory (Needed 1677720 bytes)解决方法
摘要:今天发现网站有点慢,发现mysql日志中提示mysqld-nt:Outofmemory(Needed1677720bytes),经排查是由于...

今天发现网站有点慢,发现mysql日志中提示mysqld-nt: Out of memory (Needed 1677720 bytes),经排查是由于最近调整了mysql的一些参数导致,以为内存大就不怕了,32位系统真心内容利用率很低,据说不超过4G,我们的32G内存真浪费了,以后还是使用win2008 r2或centos系统做服务器吧。废话不多说下面为大家分享下解决方法:

因为mysql版本不同可能配置略有区别,主要就是设置如下参数

key_buffer、key_buffer_size、read_buffer_size、sort_buffer_size记住了有这个参数的就改,没有也不要添加。修改后一般是降低,然后重启mysql服务即可。

核心提示:检查mysqld配置my.conf,着重看key_buffer_size, max_heap_table_size, tmp_table_size几个参数,推荐设置key_buffer_size值为max_heap_table_size的1/4.

因为服务器内存而大富余比较多,前些天把my.conf里的好几个参数调得相当大,1G甚至2G,但并不稳定,mysqld报出过几次Out of memory (Needed xxx bytes)这样的错误,分析原因时,想到是32位linux系统上的linux不支持PAE,不能使用超过3G以上的内存,所以把改大的几个参数适当改小了点,最大也只有几百M的样子,但还是出现过几次Out of memory错误。于是网上多方查询,后来受到公式

key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections

的启发,两次检查了key_buffer_size, max_heap_table_size, tmp_table_size几个参数,发现这三个值的设置是一样的,竟然都是512M!

于是改小key_buffer_size到128M,重启mysqld接下来5个小时的监测,没有再发生类似错误。

改了这几个参数后,还是有一条是Out of memory ,继续检查,发现innodb_buffer_pool_size = 1512M,于是我改为1000M,再启Mysql居然好了。

注:这台服务器一共了才3G内存:最终大至如下

key_buffer = 200M

key_buffer_size = 1294963200

#max_join_size = 4294967295

max_join_size = 1294967295

max_allowed_packet = 1M

#table_open_cache = 512

table_cache = 512

sort_buffer_size = 2294967295

read_buffer_size = 2147479552

#write_buffer_size = 4294967295

read_rnd_buffer_size = 4M

myisam_sort_buffer_size = 64M

thread_cache_size = 8

query_cache_size= 16M

php错误Fatal error: Out of memory (allocated 262144) (tried to allocate 19456 bytes

php运行一段时候后出现错误:

php错误Fatal error: Out of memory (allocated 262144) (tried to allocate 19456 bytes

意思是说:致命错误,超出内存,已经分配allocated 262144,尝试分配19456 字节。

解决方法是修改php.ini,加大memory_limit

刚刚着实吓我一跳,html可以正常访问,php不行,我还以为是受攻击呢。

后来看到www.blogguy.cn 上不去了Fatal error: Out of memory (allocated 262144) (tried to allocate 19456 bytes,知道是内存不足导致的,可是vps也连不上去,也看不到到底是谁在占内存,只能进网站后台重启vps,就不知道问题出在哪儿了。记录下来备案!

修改方法

修改php.ini

如下的区域

max_execution_time = 120 ; Maximum execution time of each script, in seconds

max_input_time = 60 ; Maximum amount of time each script may spend parsing request data

memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)

根据需要调整。

重启一下apache就可以了。

【mysqld-nt: Out of memory (Needed 1677720 bytes)解决方法】相关文章:

Starting MySQL.Manager of pid-file quit without updating file.[FAILED]的解决方法

Table ‘xxx’ is marked as crashed and should be repaired 错误解决方法参考

mysql query browser中文乱码的解决方法

mysql中文乱码的一些解决方案

mysql处理添加外键时提示error 150 问题的解决方法

mysql 发生系统错误1067的解决方法

MySQL Order By索引优化方法

Mysql启动中 InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes 的问题

mysql误删root用户或者忘记root密码解决方法

经测试最好用的mysql密码忘记的解决方法

精品推荐
分类导航