系统环境CentOS6.4 下载软件 MySQL-5.6.14.tar.gz 下载地址:http://101.110.118.67/cdn.mysql.com/archives/mysql-5.6/mysql-5.6.14.tar.gz sphinx-2.2.11-release.tar.gz 下载地址:http://sphinxsearch.com/files/sphinx-2.2.11-release.tar.gz cmake-3.6.2.tar.gz 下载地址:https://cmake.org/files/v3.6/cmake-3.6.2.tar.gz 解压 $ tar -zxvf NAME.tar.gz
gcc-c++ libstdc++-devel ncurses-devel bison autoconf automake libtool-2.* expat-dev* expat-2* mysql-devel安装命令: yum -y install 包名(支持*) :自动选择y,全自动
2.2 安装cmake
$ cd cmake-cmake-2.8.9 $ ./bootstrap $ make && make install 默认安装在 /usr/local/bin 下面,要改变安装路径,在bootstrap命令中加入'--PRefix=PATH'选项。2.3 安装mysql
$ cp -R sphinx-VERSION/mysqlse mysql-VERSION/storage/sphinx $ cd mysql-VERSION $ sh BUILD/autorun.sh $ ./configure --with-plugins=sphinx $ make && make install $ cd /usr/local/mysql-VERSION$ mkdir -p /var/log/mysql /usr/local/mysql/etc$ cp support-files/my-default.cnf /usr/local/mysql/etc/my.cnf #然后修改my.cnf [mysqld] basedir = /usr/local/mysql datadir = /usr/local/mysql/data user = root #初使化数据库$ scripts/mysql_install_db --user=root --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/ --defaults-file=/usr/local/mysql/etc/my.cnf #起动并登录 $ ./bin/mysqld_safe --defaults-extra-file=/usr/local/mysql/etc/my.cnf --user=root & $ mysql -uroot $ ln -s /usr/local/mysql/bin/mysql /usr/bin (when mysql: command not found) $ cp /usr/local/mysql/etc/my.cnf /etc/my.cnf $ cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql $ service mysql start|stop|restart /*添加服务到自启动项*/ $ chkconfig --level 3 mysql on2.4 安装sphinx engine
mysql>install plugin sphinx soname "ha_sphinx.so"; mysql>show engines; #ENGINE列表显示出SPHINX表示安装成功2.5 安装sphinx
安装sphinx
$ ./configure --prefix=/usr/local/sphinx --with-mysql $ make && make install3 mysql编码设置
mysql编码设置 编辑MySql的配置文件/etc/my.cnf
–在 [mysqld] 标签下加上三行 character_set_server = utf8 lower_case_table_names = 1 表名不区分大小写(此与编码无关) –在 [mysql] 标签下加上一行 default-character-set = utf8 –在 [mysql.server]标签下加上一行 default-character-set = utf8 –在 [mysqld_safe]标签下加上一行 default-character-set = utf8 –在 [client]标签下加上一行 default-character-set = utf8
新闻热点
疑难解答