MYSQL出错——Out Of Memory

朱丽叶与驴斗殴 2011-05-13 09:12:19
512MB内存的VPS主机上直接使用phpnow,使用默认配置,几十个人同时发帖,mysql出错——Out Of Memory。
这个有什么解决办法么?
...全文
703 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
zuoxingyu 2011-05-16
  • 打赏
  • 举报
回复
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 32M
max_connections = 1000

16+(512+8+256+512)*26/1024=48.5M
这是你贴出来的参数能算出来的需要的内存数。现在有几个问题
1:你这个机器只是做数据库服务器吗?上面还跑其他什么程序没?
2:不起数据服务,看看还剩多少物理内存
3:MYSQL使用的内存=全局共享内存+线程独享内存*线程数,你可以算出来几十个人同时发帖需要多少内存。
zuoxingyu 2011-05-16
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 t5500 的回复:]

似乎是请求的内存超过了配置文件中max_allowed_packet = 1M的限制,把这个限制改大一点试试。
[/Quote]
如果是这个原因,只会断开连接,而不会爆内存错误。
  • 打赏
  • 举报
回复
[Quote=引用 14 楼 zuoxingyu 的回复:]

key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 32M
max_……
[/Quote]

你这条公式是哪里来的?为什么乘以26而不是max_connections?
乌镇程序员 2011-05-16
  • 打赏
  • 举报
回复
似乎是请求的内存超过了配置文件中max_allowed_packet = 1M的限制,把这个限制改大一点试试。
  • 打赏
  • 举报
回复
有人知道什么原因吗?或者该调整哪些参数
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 limohao 的回复:]

参数要调整一下
[/Quote]
怎么调整?
iihero_ 2011-05-14
  • 打赏
  • 举报
回复
上err日志,在data目录下边
limohao 2011-05-14
  • 打赏
  • 举报
回复
参数要调整一下
  • 打赏
  • 举报
回复
mysql配置

key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 32M
max_connections = 1000
iihero_ 2011-05-14
  • 打赏
  • 举报
回复
max_connections=200

配置里头,把这个配小点,配成50
rucypli 2011-05-14
  • 打赏
  • 举报
回复
贴出你得配置文件my.cnf
  • 打赏
  • 举报
回复
110513 14:54:37 [ERROR] D:\PHPnow-1.5.6\MySQL-5.0.90\bin\mysqld-nt.exe: Out of memory (Needed 1047168 bytes)
.
.
.
110513 14:54:37 [ERROR] D:\PHPnow-1.5.6\MySQL-5.0.90\bin\mysqld-nt.exe: Out of memory (Needed 1047168 bytes)
110513 14:54:37 [ERROR] D:\PHPnow-1.5.6\MySQL-5.0.90\bin\mysqld-nt.exe: Out of memory (Needed 1047168 bytes)
110513 14:54:40 [ERROR] D:\PHPnow-1.5.6\MySQL-5.0.90\bin\mysqld-nt.exe: Out of memory (Needed 559240 bytes)
110513 14:54:40 - mysqld got exception 0xc0000005 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=16777216
read_buffer_size=1048576
max_used_connections=26
max_connections=200
threads_connected=13
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 425984 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
rucypli 2011-05-13
  • 打赏
  • 举报
回复
看.err错误日志
ACMAIN_CHM 2011-05-13
  • 打赏
  • 举报
回复
看一下MYSQL的错误日志中的信息,贴出来。
乌镇程序员 2011-05-13
  • 打赏
  • 举报
回复
先观察一下是MySQL还是Apache(当然,你用的不一定就是Apache)耗尽了内存。

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧