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

时间:2022-09-11 17:01:01

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 parameters but could not resolve the problem.

有没有办法改变只读权限?我读到了InnoDB参数,但无法解决问题。

3 个解决方案

#1


7  

The site you linked contains 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.

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

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

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

The innodb_ft_min_token_size is not a dynamic variable so you will have to change the config file my.cnf and 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服务器。

#2


2  

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

试试这个:在/etc/mysql/my.cnf文件中(在你的情况下位置可能不同,找到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);

#3


-1  

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

#1


7  

The site you linked contains 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.

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

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

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

The innodb_ft_min_token_size is not a dynamic variable so you will have to change the config file my.cnf and 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服务器。

#2


2  

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

试试这个:在/etc/mysql/my.cnf文件中(在你的情况下位置可能不同,找到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);

#3


-1  

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