php - 增加 MySQL 缓冲查询内存限制
问题描述
我在网上找不到答案,所以我碰运气在这里问。
如何增加 MySQL 缓冲查询内存限制?
我尝试使用 PHP 执行 PDO 查询,但出现错误Out of memory (allocated 1444937728)
。查了一会儿,发现跟PHP没有关系,跟MySQL的限制有关。
虽然更改mysql配置仍然无法解决错误。这是我的配置
[mysqld]
port = 3306
socket = C:/neard/tmp/mariadb.sock
key_buffer_size = 64M
max_allowed_packet = 64M
bulk_insert_buffer_size = 2048M
table_open_cache = 1000
sort_buffer_size = 64M
read_buffer_size = 64M
read_rnd_buffer_size = 64M
innodb_sort_buffer_size = 32M
myisam_sort_buffer_size = 32M
basedir=C:/neard/bin/mariadb/mariadb10.3.8
log-error=C:/neard/logs/mariadb.log
datadir=C:/neard/bin/mariadb/mariadb10.3.8/data
long_query_time=3
slow_query_log_file=C:/neard/logs/slow_query.log
skip-external-locking
server-id = 1
innodb_buffer_pool_size = 128M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
显然,这个数字1444937728
是在某处定义或计算的,但我找不到有关此的文档。
注意:大多数表引擎是MyISAM
解决方案
更改 php.ini 中的设置。
部分:sqlsrv
指令:sqlsrv.ClientBufferMaxKBSize。
client_buffer_max_kb_size = '50240'
sqlsrv.ClientBufferMaxKBSize = 50240
推荐阅读
- php - 如何在php中将时间戳转换为正常时间
- javascript - 如何使 Google 登录或退出按钮根据状态而变化
- python - 有什么方法可以利用其结构计算 COO 稀疏矩阵的 Hadamard 积?
- node.js - paper.js 和 Adobe Illustrator SVG:图层兼容性
- javascript - 控制台显示 Uncaught SyntaxError: Unexpected identifier
- php - PHP:计算图像中的对象组
- c# - 如何根据字符串数组的第一个元素从弹性搜索返回文档?
- mongodb - 如何在正常字段的feathersjs中查询ObjectIds?
- javascript - 将url获取的两个变量保存在两个不同的div中
- regex - 为 Fail2ban 服务实现特定正则表达式过滤器的问题