建站软件 优化软件 编程软件 网页辅助 站群程序 网站程序 图像处理 资源教程 字体下载 推荐软件


您的位置:首页 > MYSQL学习 > mysql提示错误:Out of memory

mysql提示错误:Out of memory

时间:2015-06-30 17:01:03  来源:免费模板网 作者:风雪 阅读次数 tagsmysql错误

今天导入一个300M的数据 用navicat工具提示out of memory 导致数据库导入失败,那怎么解决这个问题呢,这时候在导入数据库文件比较大的sql文件的时候就需要修改默认环境参数了

Out of memory根据我们对英文了理解是超出的内存空间,也就是说你mysql占用了大量的内存了,或是没有配置好,下面小编来给各位同学介绍一下.

MYSQL内存设置问题,可调整tmp_table_size大小解决,增大query_cache_limit 的值,还有max_heap_table_size和tmp_table_size的值.

因为我们的存储过程中用了好多的预处理语句,而且语句的结果都是非常大的,起初我的结果,代码如下:

  1. mysql> show variables like 'max_heap_table_size';  
  2. +---------------------------------+----------------------+  
  3. | Variable_name | Value |  
  4. +---------------------------------+----------------------+  
  5. | max_heap_table_size | 16777216 |  
  6. +---------------------------------+----------------------+ 
  7. mysql> show variables like 'tmp_table_size';  
  8. +---------------------------------+----------------------+  
  9. | Variable_name | Value |  
  10. +---------------------------------+----------------------+  
  11. | tmp_table_size | 16777216 |  
  12. +---------------------------------+----------------------+ 

我改了my.cnf文件,代码如下:

  1. mysql> show variables like 'max_heap_table_size';  
  2. +---------------------------------+----------------------+  
  3. | Variable_name | Value |  
  4. +---------------------------------+----------------------+  
  5. | max_heap_table_size | 67108864 |  
  6. +---------------------------------+----------------------+ 
  7. mysql> show variables like 'tmp_table_size';  
  8. +---------------------------------+----------------------+  
  9. | Variable_name | Value |  
  10. +---------------------------------+----------------------+  
  11. | tmp_table_size | 67108864 |  
  12. +---------------------------------+----------------------+ 

我的配置方法如下:

  1. [client] 
  2. #password       = your_password 
  3. port            = 3306 
  4. socket          = /var/lib/mysql/mysql.sock 
  5. # The MySQL server 
  6. [mysqld] 
  7. port            = 3306 
  8. socket          = /var/lib/mysql/mysql.sock 
  9. skip-locking 
  10. # Cache & Buffer Size 
  11. max_allowed_packet = 1G 
  12. key_buffer_size =768M 
  13. table_cache =256M 
  14. sort_buffer_size =64M 
  15. read_buffer_size =64M 
  16. read_rnd_buffer_size =64M 
  17. myisam_sort_buffer_size = 64M 
  18. tmp_table_size=256M  ====================对这里进行修改即可 
  19. query_cache_type=1 
  20. query_cache_limit=32M 
  21. connect_timeout=100000 
  22. binary logging is required for replication 
  23. log-bin=mysql-bin 
  24. binary logging format - mixed recommended 
  25. binlog_format=mixed 
  26. # required unique id between 1 and 2^32 - 1 
  27. # defaults to 1 if master-host is not set 
  28. # but will not function as a master if omitted 
  29. server-id       = 1 
  30. # Uncomment the following if you are using InnoDB tables 
  31. innodb_data_home_dir = /var/lib/mysql/ 
  32. innodb_data_file_path = ibdata1:10M:autoextend 
  33. innodb_log_group_home_dir = /var/lib/mysql/ 
  34. innodb_buffer_pool_size = 768M 
  35. innodb_additional_mem_pool_size = 512M 
  36. innodb_log_file_size = 5M 
  37. innodb_log_buffer_size = 8M 
  38. [mysqldump] 
  39. quick 
  40. max_allowed_packet = 16M 
  41. [mysql] 
  42. no-auto-rehash 
  43. # Remove the next comment character if you are not familiar with SQL 
  44. #safe-updates    
  45. [myisamchk] 
  46. key_buffer_size = 32M 
  47. sort_buffer_size = 32M 
  48. read_buffer = 8M 
  49. write_buffer = 8M 
  50. [mysqlhotcopy] 
  51. interactive-timeout

本文地址:https://www.freemoban.com/mysql/2015/0630/2237.html

猜你喜欢
栏目推荐
模板推荐

Copyright:www.freemoban.com 免费模板网 All Rights Reserved 网站备案:辽ICP备19014872号-2   辽公网安备 21010602000376号  辽公网安备:42900402000182号

免责声明:本站部分资源来自互联网收集,版权归原创者所有,如果侵犯了你的权益,我们会及时删除侵权内容,联系QQ:1615187561 谢谢合作!