如何在 Mac OS 上更改 MySQL 中 innodb_buffer_pool_size 的值?

发布于 2024-11-02 12:34:28 字数 424 浏览 1 评论 0原文

我试图增加 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

微暖i 2024-11-09 12:34:28

将其添加到您的 my.cnf

innodb_buffer_pool_size=1G

重新启动您的 mysql 使其生效

add this to your my.cnf

innodb_buffer_pool_size=1G

restart your mysql to make it effect

夏末染殇 2024-11-09 12:34:28

MySQL (<5.7.5)早期版本中唯一的设置方法

'innodb_buffer_pool_size'

变量是通过将其写入[mysqld]部分下的my.cnf(对于Linux)my.ini(对于Windows)

[mysqld]

innodb_buffer_pool_size = 2147483648

您需要重新启动您的 mysql 服务器以使其生效。

更新:

从 MySQL 5.7.5 开始,innodb_buffer_pool_size 配置选项
可以使用 SET 语句动态设置,允许您调整大小
缓冲池,无需重新启动服务器。例如:

mysql>设置全局 innodb_buffer_pool_size=402653184;

参考: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

'innodb_buffer_pool_size'

variable was by writing it to my.cnf (for linux) and my.ini (for windows) under [mysqld] section :

[mysqld]

innodb_buffer_pool_size = 2147483648

You need to restart your mysql server to have it's effect in action.

UPDATE :

As of MySQL 5.7.5, the innodb_buffer_pool_size configuration option
can be set dynamically using a SET statement, allowing you to resize
the buffer pool without restarting the server. For example:

mysql> SET GLOBAL innodb_buffer_pool_size=402653184;

Reference : https://dev.mysql.com/doc/refman/5.7/en/innodb-buffer-pool-resize.html

甜`诱少女 2024-11-09 12:34:28

我必须将该语句放在 [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.

作妖 2024-11-09 12:34:28

对于 MySQL 的标准 OS X 安装,您会发现 my.cnf 位于 /etc/ 文件夹中。

更新此变量的步骤:

  1. 加载终端。
  2. 输入cd /etc/
  3. sudo vi my.cnf
  4. 该文件应该已经存在(如果不存在,请使用 sudo find / -name 'my.cnf' 2>1 - 这将隐藏错误并仅报告 successfile 文件位置)。
  5. 使用 vi(m) 找到 innodb_buffer_pool_size 行,按 i 开始进行更改。
  6. 完成后,按 esc、shift+冒号并输入 wq
  7. 利润(完成)。

For standard OS X installations of MySQL you will find my.cnf located in the /etc/ folder.

Steps to update this variable:

  1. Load Terminal.
  2. Type cd /etc/.
  3. sudo vi my.cnf.
  4. This file should already exist (if not please use sudo find / -name 'my.cnf' 2>1 - this will hide the errors and only report the successfile file location).
  5. Using vi(m) find the line innodb_buffer_pool_size, press i to start making changes.
  6. When finished, press esc, shift+colon and type wq.
  7. Profit (done).
只涨不跌 2024-11-09 12:34:28

如上所述,

innodb_buffer_pool_size=50M

遵循其他预定义变量的约定,确保等号两侧没有空格。

然后运行

sudo service mysqld stop
sudo service mysqld start

注意

有时,例如在Ubuntu上,MySQL守护进程被命名为mysql而不是mysqld

我发现运行/etc/ init.d/mysqld restart 并不总是有效,您可能会收到类似“

Stopping mysqld:                                           [FAILED]
Starting mysqld:                                           [  OK  ]

要查看变量是否已设置,请运行 show Variables 并查看值是否已更新”之类的错误。

As stated,

innodb_buffer_pool_size=50M

Following the convention on the other predefined variables, make sure there is no space either side of the equals sign.

Then run

sudo service mysqld stop
sudo service mysqld start

Note

Sometimes, e.g. on Ubuntu, the MySQL daemon is named mysql as opposed to mysqld

I find that running /etc/init.d/mysqld restart doesn't always work and you may get an error like

Stopping mysqld:                                           [FAILED]
Starting mysqld:                                           [  OK  ]

To see if the variable has been set, run show variables and see if the value has been updated.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文