MySQL 更改 max_heap_table_size 值?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9545570/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Change max_heap_table_size value?
提问by Krueger
There's a max_heap_table_size limit to 16 mb so how can i change this value and where?
max_heap_table_size 限制为 16 mb,那么我该如何更改此值以及在哪里更改?
回答by christophmccann
I am pretty sure the max_heap_table_size is set to around 16MB by default. So I would first check what it is set to by running a query:
我很确定默认情况下 max_heap_table_size 设置为 16MB 左右。所以我会首先通过运行查询来检查它的设置:
select @@max_heap_table_size;
select @@max_heap_table_size;
And then you can run a query to set it higher:
然后您可以运行查询以将其设置得更高:
set @@max_heap_table_size=NUMBER_OF_BYTES;
set @@max_heap_table_size=NUMBER_OF_BYTES;
回答by Airy
In case you cannot change your heap value try this
如果你不能改变你的堆值试试这个
Add this to mysql/etc/my.cnf
将此添加到 mysql/etc/my.cnf
[mysqld]
tmp_table_size=2G
max_heap_table_size=2G
this will cover mysql restarts. To set these values in mysqld right now without restarting run this:
这将涵盖 mysql 重启。要立即在 mysqld 中设置这些值而不重新启动,请运行以下命令:
SET GLOBAL tmp_table_size = 1024 * 1024 * 1024 * 2;
SET GLOBAL max_heap_table_size = 1024 * 1024 * 1024 * 2;
If you are checking the above variables with
如果您正在检查上述变量
SELECT @@max_heap_table_size;
you may notice that they don't seem to change following the SET GLOBAL...
statements. This is because the settings only apply to new connections to the server. Make a new connection, and you'll see the values update.
您可能会注意到它们似乎并没有随着这些SET GLOBAL...
陈述而改变。这是因为这些设置仅适用于到服务器的新连接。建立新连接,您将看到值更新。