1. 下载 sphinx
[root@localhost ~]# cd /usr/local/src
wget http://www.sphinxsearch.com/downloads/sphinx-0.9.9.tar.gz -c
wget http://cdn.mysql.com/Downloads/MySQL-5.1/mysql-5.1.51.tar.gz -c
解压:
tar zxvf sphinx-0.9.9.tar.gz
tar zxvf mysql-5.1.51.tar.gz
mkdir /usr/local/src/mysql-5.1.51/storage/sphinx
cp /usr/local/src/sphinx-0.9.9/mysqlse/* /usr/local/src/mysql-5.1.51/storage/sphinx/
进入MYSQL 编译安装MYSQL
cd mysql-5.1.51
mkdir /usr/local/mysql
yum -y install gcc gcc-c++
./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charset=all --enable-thread-safe-client --enable-assembler --with-readline --with-big-tables --with-named-curses-libs=/usr/lib64/libncursesw.so.5 --with-plugins=sphinx
出现错误:
configure: error: unknown plugin: sphinx
首先安装:
yum -y install imake automake libtool
然后
sh BUILD/cleanup
sh BUILD/autorun.sh
然后再编译:
./configure -h
底部出现:
=== Sphinx Storage Engine ===
Plugin Name: sphinx
Description: Sphinx Storage Engines
Supports build: static and dynamic
Configurations: max, max-no-ndb
然后重新编译MYSQL
./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charset=all --enable-thread-safe-client --enable-assembler --with-readline --with-big-tables --with-named-curses-libs=/usr/lib64/libncursesw.so.5 --with-plugins=sphinx
make && make install
[root@localhost mysql-5.1.51]# groupadd mysql
[root@localhost mysql-5.1.51]# useradd -g mysql mysql
[root@localhost mysql-5.1.51]# chown -R root:mysql /usr/local/mysql/
/usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/var
[root@localhost mysql-5.1.51]# chown -R mysql /usr/local/mysql/var
[root@localhost mysql-5.1.51]# cp support-files/mysql.server /etc/init.d/
[root@localhost mysql-5.1.51]# chmod 700 /etc/init.d/mysql.server
[root@localhost mysql-5.1.51]# cp support-files/my-medium.cnf /etc/my.cnf
[root@localhost mysql-5.1.51]# /etc/init.d/mysql.server start
shell> vi ~/.bash_profile
修改PATH变量:
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin/
让修改马上生效,可以执行如下命令:source ~/.bash_profile