手抄报 安全手抄报 手抄报内容 手抄报图片 英语手抄报 清明节手抄报 节约用水手抄报

mysqld-nt: Out of memory解决方法

时间:2024-10-11 22:29:09

1、因为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.

2、因为服务器内存而大富余比较多,把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!

3、于是改小key_buffer_size到128M,重启mysqld接下来5个小时的监测,没有再发生类似错误。改了这几个参数后,还是有一条是Out of memory ,继续检查,发现innodb_buffer_pool_size = 1512M,于是我改为1000M,再启Mysql居然好了。注:这台服务器一共了才3G内存:最终大至如下

4、key_buffer = 200Mkey_buffer_size = 1294963200max_join_size = 4294967295max_join_size = 1294967295max_allowed_packet = 1Mtable_open_cache = 512table_cache = 512sort_buffer_size = 2294967295read_buffer_size = 2147479552write_buffer_size = 4294967295read_rnd_buffer_size = 4Mmyisam_sort_buffer_size = 64Mthread_cache_size = 8query_cache_size= 16M

5、php错误Fatal error: Out of memory (allocated 262144) (tried to allocate 19456 bytesphp运行一段时候后出现错误:php错误Fatal error: Out of memory (allocated 262144) (tried to allocate 19456 bytes意思是说:致命错误,超出内存,已经分配allocated 262144,尝试分配19456 字节。

6、解决方法是修改php.ini,加大memory_limit,html可以正常访问,php不行。仍然出现Fatal error: Out of memory (allocated 262144) (tried to allocate 19456 bytes,是内存不足导致的,可是vps也连不上去,

7、修改方法修改php.ini如下的区域max_execution_time = 120 ; Maximum execution time of each script,in secondsmax_input_time = 60 ;Maximum amount of time each script may spend parsing request datamemory_limit = 64M ; Maximum amount of memory a script may consume (64MB)根据需要调整。重启一下apache就可以了。

© 手抄报圈