MYSQL错误:Out of memory (Needed 1046596 bytes)
发布:smiling 来源: PHP粉丝网 添加日期:2014-09-28 17:09:56 浏览: 评论:0
Out of memory根据我们对英文了理解是超出的内存空间,也就是说你mysql占用了大量的内存了,或是没有配置好,下面小编来给各位同学介绍一下.
MYSQL内存设置问题,可调整tmp_table_size大小解决,增大query_cache_limit 的值,还有max_heap_table_size和tmp_table_size的值.
因为我们的存储过程中用了好多的预处理语句,而且语句的结果都是非常大的,起初我的结果,代码如下:
- mysql> show variables like 'max_heap_table_size';
- +---------------------------------+----------------------+
- | Variable_name | Value |
- +---------------------------------+----------------------+
- | max_heap_table_size | 16777216 |
- +---------------------------------+----------------------+
- mysql> show variables like 'tmp_table_size';
- +---------------------------------+----------------------+
- | Variable_name | Value |
- +---------------------------------+----------------------+
- | tmp_table_size | 16777216 |
- +---------------------------------+----------------------+
我改了my.cnf文件,代码如下:
- mysql> show variables like 'max_heap_table_size';
- +---------------------------------+----------------------+
- | Variable_name | Value |
- +---------------------------------+----------------------+
- | max_heap_table_size | 67108864 |
- +---------------------------------+----------------------+
- mysql> show variables like 'tmp_table_size';
- +---------------------------------+----------------------+
- | Variable_name | Value |
- +---------------------------------+----------------------+
- | tmp_table_size | 67108864 |
- +---------------------------------+----------------------+
我的配置方法如下:
- [client]
- #password = your_password
- port = 3306
- socket = /var/lib/mysql/mysql.sock
- # The MySQL server
- [mysqld]
- port = 3306
- socket = /var/lib/mysql/mysql.sock
- skip-locking
- # Cache & Buffer Size
- max_allowed_packet = 1G
- key_buffer_size =768M
- table_cache =256M
- sort_buffer_size =64M
- read_buffer_size =64M
- read_rnd_buffer_size =64M
- myisam_sort_buffer_size = 64M
- tmp_table_size=256M ====================对这里进行修改即可
- query_cache_type=1
- query_cache_limit=32M
- connect_timeout=100000
- # binary logging is required for replication
- log-bin=mysql-bin
- # binary logging format - mixed recommended
- binlog_format=mixed
- # required unique id between 1 and 2^32 - 1
- # defaults to 1 if master-host is not set
- # but will not function as a master if omitted
- server-id = 1
- # Uncomment the following if you are using InnoDB tables
- innodb_data_home_dir = /var/lib/mysql/
- innodb_data_file_path = ibdata1:10M:autoextend
- innodb_log_group_home_dir = /var/lib/mysql/
- innodb_buffer_pool_size = 768M
- innodb_additional_mem_pool_size = 512M
- innodb_log_file_size = 5M
- innodb_log_buffer_size = 8M
- [mysqldump]
- quick
- max_allowed_packet = 16M
- [mysql]
- no-auto-rehash
- # Remove the next comment character if you are not familiar with SQL
- #safe-updates //phpfensi.com
- [myisamchk]
- key_buffer_size = 32M
- sort_buffer_size = 32M
- read_buffer = 8M
- write_buffer = 8M
- [mysqlhotcopy]
- interactive-timeout
Tags: MYSQL错误 Needed 1046596 bytes
- 上一篇:mysql获取自增id方法总结
- 下一篇:mysql取随机数据慢优化方法
相关文章
- ·Mysql数据库错误代码中文说明详解(2014-10-03)
- ·mysql错误:ERROR 29 (HY000): File 'xxx.txt' not found (Errcode: 13)(2014-10-08)
- ·MySQL出现Errcode:28错误提示解决办法(2014-10-08)
- ·MYSQL错误#145的解决办法总结(2014-10-09)
- ·mysql错误代码总结(2014-10-10)
- ·mysql常用错误提示代码详解(2014-10-14)
- ·mysql出现too many connections错误提示(2014-10-14)
- ·Mysql错误Operand should contain * column解决办法(2015-04-17)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)