首页 > 代码库 > php查询mysql时,报超出内存错误(select count(distinct))时

php查询mysql时,报超出内存错误(select count(distinct))时

学时服务器查询教练所带人数时,使用select count(distinct(u_STRNO))时报超出内存错误。后参考“mysqld-nt: Out of memory解决方法”http://jingyan.baidu.com/article/020278116b428d1bcd9ce568.html?qq-pf-to=pcqq.c2c

修改参数:

key_buffer            = 512K    #global buffer   => key_buffer            = 200M    #global buffer

key_buffer_size = 3096M =>key_buffer_size = 512M

核心提示:检查mysqld配置my.conf,着重看key_buffer_size, max_heap_table_size, tmp_table_size几个参数,

推荐设置key_buffer_size值为max_heap_table_size的1/4.

修改完两个参数后,重启APACHE,问题解决。

php查询mysql时,报超出内存错误(select count(distinct))时