content_image/806116.jpg
4. Restart MySQL. 

5. Install the MeCab parser plugin: 

<img src='content_image/806116.jpg'>

•The ipadic_sjis  dictionary supports the sjis  and cp932  character sets. 

•The ipadic_utf-8  dictionary supports the utf8  and utf8mb4  character sets. 

mecab_charset  only reports the first supported character set. For example, the ipadic_utf-8  dictionary supports both utf8  and utf8mb4 . mecab_charset  always reports utf8  when this dictionary is in use. 

The MeCab parser plugin is installed using INSTALL PLUGIN  syntax. The plugin name is mecab , and the shared library name is libpluginmecab.so . For additional information about installing plugins, see Section 5.6.1, “Installing and Uninstalling Plugins” . 

INSTALL PLUGIN mecab SONAME ’libpluginmecab.so’; 

Once installed, the MeCab parser plugin loads at every normal MySQL restart. 

6. Verify that the MeCab parser plugin is loaded using the SHOW PLUGINS  statement. 

## Creating a FULLTEXT Index that uses the MeCab Parser 

mysql> SHOW PLUGINS; 

A mecab  plugin should appear in the list of plugins. 

To create a FULLTEXT  index that uses the mecab parser, specify WITH PARSER ngram  with CREATE TABLE , ALTER TABLE , or CREATE INDEX . 

This example demonstrates creating a table with a mecab FULLTEXT  index, inserting sample data, and viewing tokenized data in the INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE  table: 

mysql> USE test; mysql> CREATE TABLE articles ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), body TEXT, FULLTEXT (title,body) WITH PARSER mecab ) ENGINE=InnoDB CHARACTER SET utf8; mysql> SET NAMES utf8; mysql> INSERT INTO articles (title,body) VALUES (’ データベース管理 ’,’ このチュートリアルでは、私はどのようにデータベースを管理する方法を紹介します ’), (’ データベースアプリケーション開発 ’,’ データベースアプリケーションを開発することを学ぶ ’); mysql> SET GLOBAL innodb_ft_aux_table="test/articles"; mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE ORDER BY doc_id, position; 

To add a FULLTEXT  index to an existing table, you can use ALTER TABLE  or CREATE INDEX . For example: 

CREATE TABLE articles ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), body TEXT 

