本文讲的是源码Tarball的安装方式,不是RPM安装方式,为了以后后到sphinx,安装时把mysql的sphinx引擎也安装上去。
从mysql官网找到mysql的源码下载,这里下载的是Generic Linux (Architecture Independent), Compressed TAR Archive(mysql-5.1.52.tar.gz )版本,如下:
从sphinx官网上找到sphinx的安装源码,sphinx目前有1.1beta版和0.9.9-release版,1.1beta版还不太稳定,安装mysql的sphinx引擎,编译mysql时提示configure: error: unknown plugin: sphinx错误,这里就下0.9.9-release版,如下:
都下载完后就解压缩,如下:
解压后得到mysql的源代码文件夹为/usr/local/src/mysql-5.1.52,sphinx的源码文件为/usr/local/src/sphinx-0.9.9,然后把sphinx源码文件夹/usr/local/src/sphinx-0.9.9/mysqlse下的所有文件复制到mysql源码文件夹/usr/local/src/mysql-5.1.52/storage/sphinx下,如下:
复制完后进入到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/lib/libncursesw.so.5 --with-plugins=sphinx
make && make install
安装完后对mysql进行些初始化工作,如下:
mysql #在mysql服务启动的情况下进入mysql命令行
show engines; #查看mysql引擎,就会看到 SPHINX引擎,如下:
mysql> show engines;
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
| CSV | YES | CSV storage engine | NO | NO | NO |
| SPHINX | YES | Sphinx storage engine 0.9.9 | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
5 rows in set (0.01 sec)
mysql安装就讲到这,下次讲sphinx的安装与使用。