问题
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.
回答1:
You should change this system parameter, restart server and then rebuild ALL FULLTEXT indexes.
REPAIR TABLE <TableName> QUICK;
- Change the full text index minimum word length with MySQL
回答2:
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';
回答3:
I think you should try altering table by drop index and again add index. It will surely work.
回答4:
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.
回答5:
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;
来源:https://stackoverflow.com/questions/14646738/set-new-value-for-ft-min-word-len-fulltext-in-mysql