问题
Is it possible to set ft_min_word_len for a certain user (such as by placing a my.cnf file in the user home dir with ft_min_word_len set)? The documentation says I need to restart the server after making this change, but a user does not have access to do that.
回答1:
I'm working with this now, so to add as a reference for anyone looking at this...
- You can use this query in a query browser or the MySQL prompt to show the state of ft_min_word_len: "SHOW VARIABLES LIKE 'ft_min_word_len';"
- ft_min_word_len deafults to a value of '4' and is not by default listed in "my.cnf". To change it's default value, add: "ft_min_word_len = 3" to my.cnf under the [mysqld] section.
- After changing the value of ft_min_word_len, the server must be restarted.
- After changing the value of ft_min_word_len, any indexes you have must be rebuilt
- A fast way to rebuild an index is to
use this query: "REPAIR TABLE
your_table_name QUICK;" Note:
You're using the name of the table
only, not the name of any indexes.
If you have more than one index against the 'your_table_name' table, all of them will be re-built.
回答2:
No, it's not possible, because it changes how the fulltext indices are built. It takes effect at index generation, not (only) at query time.
FYI: Not only do you have to restart the server, you have to rebuild all your fulltext indices after changing it.
来源:https://stackoverflow.com/questions/1255632/ft-min-word-len-set-in-local-my-cnf