先去官網下載sphinx引擎包
我下載的是sphinx-2.2.6-release.tar.gz
tar -zxf sphinx-2.2.6-release.tar.gz下載mysql源碼包(注意要與當前的mysql版本相同)
tar -zxf mysql-5.6.19.tar.gz在解壓的mysql目錄中創建sphinx目錄
路徑是mysql-5.6.19/storage/sphinx
把sphinx-2.2.6包裡mysqlse下的文件cp到mysql-5.6.19/storage/sphinx
進入mysql-5.6.19
cd mysql-5.6.19 #sh BUILD/autorun.sh #./configure如果出現- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)CMake Error at cmake/readline.cmake:82 (MESSAGE): Curses library not found. Please install appropriate package……
請
yum install ncurses-devel再刪除剛才編譯生成的 CMakeCache.txt 文件
再執行
#./configure然後make(只是make不要install)
將make好的文件復制到mysql的目錄中
cp storage/sphinx/.libs/ha_sphinx.* /usr/local/mysql/lib/plugin然後把復制的文件更改屬主屬組
登陸mysql
加載sphinx存儲模塊
mysql> INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so';查看引擎模塊是否正常加載
mysql> show engines;如需卸載請在mysql中執行
mysql> UNINSTALL PLUGIN sphinx;