Older versions of MySQL's full-text indexes can be used only on fields of char, varchar, and text in the MyISAM table.
However, the new version of the MySQL5.6.24 on the InnoDB engine also joined the full-text index, so the specific information you can always pay attention to the official website,
Let me talk about the use of MySQL full-text indexing, online a lot of, I only talk about what I know the drop part ha:
My MySQL version is:
Create a new table test:
CREATE TABLE' Test ' (' name 'Char( A) not NULL DEFAULT "', ' nickname 'Char( A) not NULL DEFAULT "', FulltextKEY' name ' (' Name ', ' nickname ')) ENGINE=InnoDBDEFAULTCHARSET=UTF8MB4;
Insert test data:
INSERT into' Test ' (' name ', ' nickname ')VALUES("Matt", "I like Laravel");INSERT into' Test ' (' name ', ' nickname ')VALUES("Matt", "I like Laravel");INSERT into' Test ' (' name ', ' nickname ')VALUES("Gibson", "I don't like laravel ah");INSERT into' Test ' (' name ', ' nickname ')VALUES("Gibson", "I will not Ah");INSERT into' Test ' (' name ', ' nickname ')VALUES("Kevin", "I really won't");INSERT into' Test ' (' name ', ' nickname ')VALUES("Mary", "I really won't");
OK, data interface and test data have been added, back to "full-text index" ... Let's say basic use:
1. Create a full-text index (fulltext index) 1.1. Create a full-text index while creating a table
CREATE TABLE' Test ' (' name 'Char( A) not NULL DEFAULT "', ' nickname 'Char( A) not NULL DEFAULT "', FulltextKEY' name ' (' Name ', ' nickname ')) ENGINE=InnoDBDEFAULTCHARSET=UTF8MB4;
1.2. Add by ALTER TABLE
ALTER TABLE ADD INDEX username (' name ') #username is the name of the index, either randomly or:ALTERTABLEADD fulltext username (' Name ')
1.3. Directly through the CREATE INDEX method
CREATE INDEX on ' Test ' (' name ') CREATE INDEX on ' Test ' (' name ')# You can also specify the length of the index at the time the index is created
2. Delete full-text index 2.1. Use DROP Index directly (note: No drop fulltext Index this usage)
DROP INDEX on test
2.2. How to use ALTER TABLE
ALTER TABLE DROP INDEX username;
3. Using Full-Text indexing
Slightly different from normal index
Format using full-Text indexing: MATCH (columnName) against (' string ')
Like what:
Not to be continued ...
Fuzzy query of MySQL full-text index