如何更改只读权限以设置 MySQL 服务器系统变量的新值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23670855/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 20:31:19  来源:igfitidea点击:

How to change read-only permission to set new value of MySQL server system variable

mysqldatabasesystem-variable

提问by Rocoder

I am new to MySQL; recently I faced this problem while setting a new value for a system variable.

我是 MySQL 的新手;最近我在为系统变量设置新值时遇到了这个问题。

I tried:

我试过:

mysql> set global innodb_ft_min_token_size = 6;

but I am getting this error:

但我收到此错误:

ERROR 1238 (HY000): Variable 'innodb_ft_min_token_size' is a read only variable

Is there any way to change the read only permission? I read about InnoDB parametersbut could not resolve the problem.

有什么办法可以更改只读权限吗?我阅读了InnoDB 参数,但无法解决问题。

回答by GhostGambler

The site you linkedcontains all information needed:

您链接的网站包含所需的所有信息:

System variables that are true or false can be enabled at server startup by naming them [...]

System variables that take a numeric value can be specified as --var_name=value on the command line or as var_name=value in option files.

Many system variables can be changed at runtime (see Section 5.1.5.2, “Dynamic System Variables”).

可以在服务器启动时通过将它们命名为 true 或 false 来启用系统变量 [...]

采用数值的系统变量可以在命令行中指定为 --var_name=value 或在选项文件中指定为 var_name=value 。

许多系统变量可以在运行时更改(请参阅第 5.1.5.2 节,“动态系统变量”)。

The innodb_ft_min_token_sizeis not a dynamic variableso you will have to change the config file my.cnfand add innodb_ft_min_token_size=6. Alternatively you need to change the startup command of your MySQL server.

innodb_ft_min_token_size不是动态变量,因此您必须更改配置文件my.cnf并添加innodb_ft_min_token_size=6. 或者,您需要更改 MySQL 服务器的启动命令。

After the change you must restart your MySQL server.

更改后,您必须重新启动 MySQL 服务器。

回答by proprius

Try this: In /etc/mysql/my.cnffile(location in your case could be different, do locate my.cnfto find the location for your system), add/modify:

试试这个:在/etc/mysql/my.cnf文件中(你的情况下的位置可能不同,locate my.cnf找到你系统的位置),添加/修改:

[mysqld]
innodb_ft_min_token_size = 2

to set the minimum limit to 2. Don't forget to restart the mysql server and rebuilding the fulltext index. For me, the following worked like a charm.

将最小限制设置为 2。不要忘记重新启动 mysql 服务器并重建全文索引。对我来说,以下工作就像一个魅力。

drop index index_stem on  maps;
CREATE FULLTEXT INDEX index_stem ON maps(stem_value);

回答by git2go

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 5.7.5 开始,可以使用 SET 语句动态设置 innodb_buffer_pool_size 配置选项,允许您在不重新启动服务器的情况下调整缓冲池的大小。例如:

mysql> SET GLOBAL innodb_buffer_pool_size=402653184;

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

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