ubuntu系统,比较折腾
要安装gcc,g++
然后下载mmseg包,编译安装,需要修改cpp文件:
编辑src/css目录下UnigramCorpusReader.cpp 文件,在其第一行加上
#include <string.h>
mmseg安装完毕。
解压sphinx-0.9.9.tar.gz,里面有个mysqlse目录,拷贝到mysql源码目录 mysql-5.1.42/
cp -rf sphinx-0.9.9/mysqlse mysql-5.1.42/storage/
开始编译mysql:
./configure –with-plugins=sphinx –prefix=/home/mysql/
如无意外,会跳个error: No curses/termcap library found错误。
apt-get install libncurses5-dev
安装这个先,继续:
再出现个错误: error: unknown plugin: sphinx
执行
sh BUILD/autorun.sh
继续出错:BUILD/autorun.sh: line 23: aclocal: command not found
需要安装automake,apt-get install automake,apt-get install libtool继续执行:
无错了。
在mysql安装目录check下sphinx插件
./configure -h | grep sphinx
Plugin Name: sphin
生效了,configure下,Thank you for choosing MySQL!
看来是ok了,make;make install
安装完成.
/home/mysql/bin/mysqldump –user=user –password=pass –default-character-set=gbk mydb > dump.sql
sed -r ‘s/CHARSET=gbk/CHARSET=utf8/g’ dump.sql > dump_utf.sql
/home/mysql/bin/mysql –user=user –password=pass –execute=”DROP DATABASE mydb; CREATE DATABASE mandb CHARACTER SET utf8 COLLATE utf8_general_ci;”
/home/mysql/bin/mysql –user=user –password=pass –default-character-set=utf8 mydb < dump_utf.sql
注意几点,debian系统安装需要bison, byacc,再重新configure。
如碰到*** [tokenizer_zhcn.o] 错误 1
mmseg/include/mmseg/freelist.h 加入#include <string.h>