Mysqlでmecabプラグインをインストールしたい
mysqlでmecabのプラグインをインストールしたいのですが、
以下のエラーメッセージが発生して、インストールできません。
発生している問題・エラーメッセージ
sql
1mysql> INSTALL PLUGIN mecab SONAME 'libpluginmecab.so'; 2ERROR 1123 (HY000): Can't initialize function 'mecab'; Plugin initialization function failed.
error.log
2018-04-25T11:56:45.125957Z 5 [Note] Mecab: Trying createModel(--rcfile=/etc/mecabrc) 2018-04-25T11:56:45.127626Z 5 [ERROR] Mecab: createModel() failed: param.cpp(69) [ifs] no such file or directory: /etc/mecabrc 2018-04-25T11:56:45.128116Z 5 [ERROR] Plugin 'mecab' init function returned error. 2018-04-25T11:56:45.128537Z 5 [Note] Shutting down plugin 'mecab'
実行環境
vagrantで起動しているローカルサーバです。
- NAME="Ubuntu"
VERSION="16.04.4 LTS (Xenial Xerus)"
- mysql Ver 14.14 Distrib 5.7.21, for Linux (x86_64) using EditLine wrapper
- mecab of 0.996
/etc/mecabrc の中身
; Configuration file of MeCab ; ; $Id: mecabrc.in,v 1.3 2006/05/29 15:36:08 taku-ku Exp $; ; ;dicdir = /var/lib/mecab/dic/debian dicdir = /usr/lib/mecab/dic/mecab-ipadic-neologd ; userdic = /home/foo/bar/user.dic ; output-format-type = wakati ; input-buffer-size = 8192 ; node-format = %m\n ; bos-format = %S\n ; eos-format = EOS\n
試したこと
無いと言われているファイルの確認。
このファイルのパーミッションを試しに777へ変更してみましたが、エラーは変わりませんでした。(パーミッションは戻してあります)
root@vagrant:~# ls -la /etc/mecabrc -rw-r--r-- 1 root root 338 Apr 25 20:43 /etc/mecabrc
my.cnfの確認
[mysqld] # MeCab Full-Text Parser Plugin Settings loose-mecab-rc-file=/etc/mecabrc innodb_ft_min_token_size=1
libpluginmecab.soの存在確認
sql
1mysql> show variables like 'plugin_dir'; 2+---------------+------------------------+ 3| Variable_name | Value | 4+---------------+------------------------+ 5| plugin_dir | /usr/lib/mysql/plugin/ | 6+---------------+------------------------+
root@vagrant:~# ls -la /usr/lib/mysql/plugin/*mecab* -rw-r--r-- 1 root root 15064 Dec 28 13:11 /usr/lib/mysql/plugin/libpluginmecab.so
mysql.pluginにインサートするらしいので、念のためmysql,rootユーザーの権限確認
sql
1mysql> SHOW GRANTS FOR 'root'@'localhost'; 2+---------------------------------------------------------------------+ 3| Grants for root@localhost | 4+---------------------------------------------------------------------+ 5| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION | 6| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION | 7+---------------------------------------------------------------------+
mysql.pluginを確認
mysql> select * from mysql.plugin\G *************************** 1. row *************************** name: auth_socket dl: auth_socket.so 1 row in set (0.00 sec)
環境変数MECABRCを設定しておくと良いらしいので試したけど駄目でした。
root@vagrant:~# export MECABRC=/etc/mecabrc root@vagrant:~# echo $MECABRC /etc/mecabrc