// 安裝所需套件
# apt-get install build-essential automake libtool libmysqlclient-dev libmecab-dev libicu-dev mecab libicu48 libicu-dev
// 下載 mysqlftppc-mecab
$ git clone https://github.com/y-ken/mysqlftppc-mecab.git
$ cd mysqlftppc-mecab
// 檢查系統設定、編譯、安裝
$ aclocal
$ libtoolize --automake
$ automake --add-missing
$ automake
$ autoconf
$ ./configure
$ make
# make install
// 在 MySQL 新增插件
$ mysql -uroot -p -e "INSTALL PLUGIN mecab SONAME 'libftmecab.so';"
$ mysql -u root -p
mysql> show plugins;
mysql> SHOW STATUS LIKE "Mecab_info";
+---------------+-------------------------------+
| Variable_name | Value |
+---------------+-------------------------------+
| Mecab_info | with mecab 0.996, without ICU |
+---------------+-------------------------------+
mysql> SHOW VARIABLES LIKE "mecab%";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| mecab_dicdir | |
| mecab_userdic | |
+---------------+-------+
// 設定 mecab
$ mecab --dump-config | grep dicdir
/var/lib/mecab/dic/debian
# vi /etc/mysql/my.cnf
[mysqld]
# mysqlftppc
mecab_dicdir = /var/lib/mecab/dic/debian
# /etc/init.d/mysql restart
// 可執行測試
$ cd test
$ sh test.sh
ok
// 建立或轉換資料表支援 mecab parser
http://a0726h77.blogspot.tw/2013/10/mysql-create-full-text-search-table.html
Reference :
y-ken/mysqlftppc-mecab
mysqlftppc-mecab/README.md at master · y-ken/mysqlftppc-mecab
Mysqlftppcを入れてみた - まめ畑
沒有留言:
張貼留言