如何在 Mac OS 上更改 MySQL 中 innodb_buffer_pool_size 的值?
我试图增加 MySQL 5.1 中 innodb_buffer_pool_size 的大小,因为我不断遇到以下错误,表明我的表锁空间不足。
ERROR: The total number of locks exceeds the lock table size
Error
Code: 1206
我已经阅读了文档,根据我收集的信息,我需要更新 /etc/my.cnf 文件中的 innodb_buffer_pool_size 。我当前的值为8M。然而,即使在创建该文件并添加以下行来设置值之后,它也不会在 MySQL 中更新。
set-variable=innodb_buffer_pool_size=256M
对于如何在 Mac 上的 MySQL 中调整此值,有什么建议吗?还有其他意见或建议吗?
I am trying to increase the size of the innodb_buffer_pool_size in MySQL 5.1 as I keep running into the following error indicating I have run out of space for the table locks.
ERROR: The total number of locks exceeds the lock table size
Error
Code: 1206
I have gone through the documentation and from what I gather, I need to update innodb_buffer_pool_size in the /etc/my.cnf file. My current value is 8M. However, even after creating that file and adding the following line to set the value it is not updating in MySQL.
set-variable=innodb_buffer_pool_size=256M
Does have any advice on how I can adjust this value in MySQL on my mac? Any other advice or suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
将其添加到您的 my.cnf
重新启动您的 mysql 使其生效
add this to your my.cnf
restart your mysql to make it effect
在MySQL (<5.7.5)早期版本中唯一的设置方法
变量是通过将其写入[mysqld]部分下的my.cnf(对于Linux)和my.ini(对于Windows):
您需要重新启动您的 mysql 服务器以使其生效。
更新:
参考:https://dev。 mysql.com/doc/refman/5.7/en/innodb-buffer-pool-resize.html
In the earlier versions of MySQL ( < 5.7.5 ) the only way to set
variable was by writing it to my.cnf (for linux) and my.ini (for windows) under [mysqld] section :
You need to restart your mysql server to have it's effect in action.
UPDATE :
Reference : https://dev.mysql.com/doc/refman/5.7/en/innodb-buffer-pool-resize.html
我必须将该语句放在 [mysqld] 块下才能使其工作。否则,更改不会得到反映。我有一个 REL 发行版。
I had to put the statement under the [mysqld] block to make it work. Otherwise the change was not reflected. I have a REL distribution.
对于 MySQL 的标准 OS X 安装,您会发现 my.cnf 位于 /etc/ 文件夹中。
更新此变量的步骤:
cd /etc/
。sudo vi my.cnf
。innodb_buffer_pool_size
行,按i
开始进行更改。wq
。For standard OS X installations of MySQL you will find my.cnf located in the /etc/ folder.
Steps to update this variable:
cd /etc/
.sudo vi my.cnf
.sudo find / -name 'my.cnf' 2>1
- this will hide the errors and only report the successfile file location).innodb_buffer_pool_size
, pressi
to start making changes.wq
.如上所述,
遵循其他预定义变量的约定,确保等号两侧没有空格。
然后运行
注意
有时,例如在Ubuntu上,MySQL守护进程被命名为
mysql
而不是mysqld
我发现运行
/etc/ init.d/mysqld restart
并不总是有效,您可能会收到类似“要查看变量是否已设置,请运行
show Variables
并查看值是否已更新”之类的错误。As stated,
Following the convention on the other predefined variables, make sure there is no space either side of the equals sign.
Then run
Note
Sometimes, e.g. on Ubuntu, the MySQL daemon is named
mysql
as opposed tomysqld
I find that running
/etc/init.d/mysqld restart
doesn't always work and you may get an error likeTo see if the variable has been set, run
show variables
and see if the value has been updated.