MySQL 除了my.cnf,还有哪里可以访问变量innodb_buffer_pool_size?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13769598/
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
Where else can the variable innodb_buffer_pool_size be accessed besides my.cnf?
提问by kelly johnson
I've installed MAMP and have the latest phpMyAdmin on my Mac. I do not have a my.cnf
nor a my.ini
file. Yes, I have enabled all invisible files.
我已经安装了 MAMP 并在我的 Mac 上安装了最新的 phpMyAdmin。我没有也my.cnf
没有my.ini
文件。是的,我已启用所有不可见文件。
I've heard the free version of MAMP doesn't let you, but that doesn't seem right. I know MAMPPro has a drop-down but I'm not buying that.
我听说 MAMP 的免费版本不允许您这样做,但这似乎不对。我知道 MAMPPro 有一个下拉菜单,但我不买。
What else could the file be called?
这个文件还能叫什么?
EDIT: I used grep to search for innodb_buffer_pool_size within the entire MAMP folder and the only files that had that variable inside were assigning an array to it, not just a simple size. Just for more completeness on this question.
编辑:我使用 grep 在整个 MAMP 文件夹中搜索 innodb_buffer_pool_size 并且唯一包含该变量的文件正在为其分配一个数组,而不仅仅是一个简单的大小。只是为了更完整地解决这个问题。
回答by RolandoMySQLDBA
You can do the following:
您可以执行以下操作:
MySQL 5.0+
MySQL 5.0+
SHOW VARIABLES LIKE 'innodb_buffer_pool_size';
MySQL 5.1+
MySQL 5.1+
SELECT variable_value FROM information_schema.global_variables
WHERE variable_name = 'innodb_buffer_pool_size';
In order to set it for MySQL, you must have a physically manifest my.cnf
or my.ini
为了为 MySQL 设置它,你必须有一个物理清单my.cnf
或my.ini
Add this to the config file
将此添加到配置文件中
[mysqld]
innodb_buffer_pool_size = 1G
and restart mysql
并重新启动mysql
You can try placing the my.cnf
in /etc
and restarting mysql
你可以试着放置my.cnf
在/etc
并重新启动mysql的
Please keep in mind that 128M is the default value for innodb_buffer_pool_size in MySQL 5.5. Once you get my.cnf in the correct place in the DB Server and restart mysql, things will be different.
请记住,128M 是 MySQL 5.5 中 innodb_buffer_pool_size 的默认值。一旦将 my.cnf 放在 DB Server 中的正确位置并重新启动 mysql,事情就会有所不同。
回答by daemonofchaos
If you have a configuration file for MySQL from MAMP then it would be located in /Applications/MAMP/db/mysql/my.cnf.
如果您有来自 MAMP 的 MySQL 配置文件,那么它将位于 /Applications/MAMP/db/mysql/my.cnf 中。
If there is no configuration file then the default value of 8MB.
如果没有配置文件那么默认值为8MB。