XAMPP MySQL - 设置 ft_min_word_len

2022-01-14 00:00:00 xampp mysql

我的计算机上安装了 XAMPP,并通过它在本地主机上使用 MySQL 进行个人项目.

I have XAMPP installed on my computer, and am using MySQL through it on localhost for a personal project.

我正在尝试将布尔模式下全文搜索的 ft_min_word_len 变量从默认值 4 设置为 2.

I am trying to set the ft_min_word_len variable for fulltext searches in boolean mode to 2 from the default of 4.

我已经尝试过(在从 XAMPP 控制面板停止 MySQL 之后):

I've tried (after stopping MySQL from the XAMPP control panel):

  • 从 XAMPP 控制面板打开 Shell,并在提示符下输入:
    mysqld ft_min_word_len=2
    当我之后使用 mysqld --help --verbose 检查 ft_min_word_len 的值时,这似乎对 ft_min_word_len 没有任何影响(当我尝试使用 mysqladmin variables 时出现错误> 在提示符下).

  • Opening Shell from the XAMPP control panel, and typing at the prompt:
    mysqld ft_min_word_len=2
    This doesn't appear to have any effect on ft_min_word_len when I check its value afterwards with mysqld --help --verbose (I get an error when I try to use mysqladmin variables at the prompt).

使用以下文本在 XAMPPmysqlin 中创建一个 my.cnf 文件:
# MySQL 服务器
[mysqld]
ft_min_word_len=2
当我使用 mysqld --help --verbose 检查它的值时,这似乎改变了 ft_min_word_len 的值.
但是,当我从 XAMPP 的控制面板再次启动 MySQL,然后检查通过 PHPMyAdmin 使用 SHOW VARIABLES LIKE 'ft_min_word_len' 获取 ft_min_word_len 的值,在我重建全文索引之前和之后,它仍然是 4.

Creating a my.cnf file in XAMPPmysqlin with this text:
# The MySQL server
[mysqld]
ft_min_word_len=2
This does appear to change the value of ft_min_word_len when I check its value with mysqld --help --verbose.
However, when I start MySQL again from XAMPP's control panel, and then check the value of ft_min_word_len through PHPMyAdmin with SHOW VARIABLES LIKE 'ft_min_word_len', it is still 4, both before and after I rebuild the fulltext indexes.

在停止和启动 MySQL 之间,我已多次尝试每种方法.SHOW VARIABLES LIKE 'ft_min_word_len' 确实显示了 2 的值,但下次我停止并重新启动 MySQL 时,该值已恢复为 4,我无法再次将其设置为 2.

I've tried each approach multiple times, in between stopping and starting MySQL. SHOW VARIABLES LIKE 'ft_min_word_len' did show a value of 2 once, but the next time I stopped and restarted MySQL, the value had returned to 4, and I have been unable to set it to 2 again.

任何正确方向的指针将不胜感激.

Any pointers in the right direction would be appreciated.

推荐答案

my.cnf 文件保存在 mysqlin 文件夹中,然后重试.

Keep you my.cnf file in <XAMPP>mysqlin folder and try again.

相关文章