set new value for “ft_min_word_len ” FULLTEXT in m

2019-02-12 14:05发布

I changed to "ft_min_word_len" = 4 by my-innodb-heavy-4G.ini located in my system path "C:\Program Files\MySQL\MySQL Server 5.1" , but when i run

SHOW VARIABLES LIKE 'ft_min_word_len'

I got still result value= 4. I did not find this variable in my.ini file. So i have also create a my logic. I copied to ft_min_word_len variable and place in my.ini file and now my result show value=3.

But it is not working for three character search. I've restarted server.

How can i achieve to be able to search three character value also.

5条回答
干净又极端
2楼-- · 2019-02-12 14:52

You should change this system parameter, restart server and then rebuild ALL FULLTEXT indexes.

REPAIR TABLE <TableName> QUICK;
查看更多
够拽才男人
3楼-- · 2019-02-12 14:52

This is what I use for getting all needed repair commands:

SELECT DISTINCT CONCAT("REPAIR TABLE `", TABLE_SCHEMA, "`.`", 
TABLE_NAME, "` QUICK;") FROM information_schema.STATISTICS 
WHERE index_type = 'FULLTEXT';
查看更多
SAY GOODBYE
4楼-- · 2019-02-12 15:02

I think you should try altering table by drop index and again add index. It will surely work.

查看更多
叼着烟拽天下
5楼-- · 2019-02-12 15:02

You could just drop and add the FULLTEXT index

or do it in stages and see how big it will get in advance

CREATE TABLE models_new LIKE models;

ALTER TABLE models_new DROP INDEX name;

ALTER TABLE models_new ADD FULLTEXT name (name);

ALTER TABLE models_new DISABLE KEYS;

INSERT INTO models_new SELECT * FROM models;

ALTER TABLE models_new ENABLE KEYS;

ALTER TABLE models RENAME models_old;

ALTER TABLE models_new RENAME models;

查看更多
迷人小祖宗
6楼-- · 2019-02-12 15:03

I just had and solved a similar problem of my own. The problem in my case is that the my.ini file I needed to edit in order to change the ft_min_word_len variable was in a directory that's hidden/protected by default in Windows 7. That's: "c:/programdata/mysql/mysql server 5.7".

Windows file explorer and searches don't show this location until you go into folder options and specify that you want to see hidden files/folders (and possibly protected operating system files--I did both).

Initially I created a my.cnf file under Program Files/MySQL Server 5.7. But when I restarted the server the ft_min_word_len variable hadn't changed. Then I typed in some random text that I knew should trigger an error, but the server started up like normal. It seems that MySQL wasn't reading the file, even though it was in one of the locations specified in the help text from the MySQL client shell.

My thinking is that the MySQL server starts searching for .cnf/.ini files in the order specified in the help text, but once it finds a valid file, stops searching. Just a theory, but I can say for sure that it wasn't recognizing configuration files in the other places it was supposed to be looking.

I figured it was like CSS, where each new CSS file overrides settings in the previous. Evidently not.

Anyway, I hope this will be of help to anyone else who runs into the same problem.

查看更多
登录 后发表回答