如何在linux下安装linux备份mysql数据库库并配置

欢迎您光临亿恩科技官网!
域名常见问题
虚拟主机使用指南
云主机使用指南
服务器租用/托管指南
服务器租用/托管指南
智能建站使用指南
> >文章内容
Windows或Linux下重置Mysql数据库root超级管理员密码的方法
发布时间:&& 17:43:37
Windows或Linux下重置Mysql数据库root超级管理员密码的方法就是先修改配置文件,作用是让操作Mysql数据库的时候可以跳过验证,即不输入密码就可以登陆Mysql数据库进行操作,然后直接通过update语句修改mysql库user表中root账号的密码,完成后再把Mysql的配置文件修改回需要验证登陆的状态,重新启动数据库服务即可。
下面是重置root账号的密码的步骤:
一、修改Mysql配置文件。
Windows环境中的配置文件在mysql安装目录中的my.ini(如C:\Program Files\MySQL\MySQL Server 5.1\my.ini)。Linux环境中的配置文件在/f。
打开配置文件,在文件的最后添加如下一行:
skip-grant-tables
保存配置文件,退出编辑。
二、重启Mysql服务。
Windows下使用如下命令:
net stop mysql
net start mysql
/etc/init.d/mysqld restart
三、设置root账号的新密码
首先进入mysql,此时已经不需要密码,输入如下命令,直接进入
mysql -u root -p
提示输入密码时直接按回车即可进入。
然后选择 mysql 数据库:
然后更新root的密码为 123456 :
update user set password=PASSWORD('123456') where user='root';
运行上面语句,密码就已经被替换为123456。
四、密码更新后,重新将配置文件修改,去掉最后一行的&skip-grant-tables ,按照上面的方法重启数据库服务,然后就可以用刚才设置的新密码登陆Mysql数据库了。本文出自:亿恩科技【】
亿恩北京公司:
经营性ICP/ISP证:京B2-
地址:北京市中关村大街27号中关村大厦13层
亿恩南昌公司:
经营性ICP/ISP证:赣B2-
地址:南昌市洪城路国贸广场A区巨豪峰13层
亿恩郑州公司:
经营性ICP/ISP/IDC证:豫B1.B2-
地址:郑州市高新区翠竹街1号总部企业基地亿恩大厦
扫扫关注-微信公众号
400-723-6868
Help center
ENKJ All Rights Reserved 亿恩科技 版权所有   亿恩科技法律顾问:国银律师事务所张君律师  
  经营性ICP/ISP证:京B2-Linux下MySQL的下载、安装及启动
时间: 15:29:04
&&&& 阅读:1110
&&&& 评论:
&&&& 收藏:0
标签:&&&&&&&&&&&&&&&&&&&&&&&&&&&测试环境
主机系统:Win7 64位
虚拟机:VMware& Workstation 11.1.0
虚拟机系统:CentOS 6.5 64位&& Kernel 2.6.32-431.e16.x86_64
MySQL: 5.6.24
1. Mysql的下载
b. 下载跟OS对应的mysql版本
[root@localhost ~]# uname&&a&&&&&&&&&&&&&&&&&&&&&&&&&& 注:查看Linux版本信息,我这里是64位Linux系统
Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC
x86_64 x86_64 GNU/Linux
c. 在下拉列表选择Linux-Generic,下载64位的安装包
2. Mysql的安装
a. 将下载好的mysql制作成光盘镜像
不清楚的可以参考文章&
b. 解压缩tar包
[root@localhost MySQL]# tar -xvf MySQL-5.6.24-1.linux_glibc2.5.x86_64.rpm-bundle.tar MySQL-shared-compat-5.6.24-1.linux_glibc2.5.x86_64.rpmMySQL-test-5.6.24-1.linux_glibc2.5.x86_64.rpmMySQL-devel-5.6.24-1.linux_glibc2.5.x86_64.rpmMySQL-client-5.6.24-1.linux_glibc2.5.x86_64.rpmMySQL-embedded-5.6.24-1.linux_glibc2.5.x86_64.rpmMySQL-server-5.6.24-1.linux_glibc2.5.x86_64.rpmMySQL-shared-5.6.24-1.linux_glibc2.5.x86_64.rpm
加压缩后这里有好几个rpm包,我们只要安装如下两个包即可
MySQL-server-5.6.24-1.linux_glibc2.5.x86_64.rpm
MySQL-client-5.6.24-1.linux_glibc2.5.x86_64.rpm
c. 更改安装包权限
解压缩后的安装包只有读写的权限,需要将其更改为可读可写可执行
[root@localhost MySQL]# lltotal 622244-rwxr--r--. 1 root root&
May 26 02:11 MySQL-5.6.24-1.linux_glibc2.5.x86_64.rpm-bundle.tar-rw-r--r--. 1 7155 wheel&
Mar 26 03:57 MySQL-client-5.6.24-1.linux_glibc2.5.x86_64.rpm-rwxr--r--. 1 root root&&& 3848304 May 26 02:11 mysql-connector-java-5.1.35.tar.gz-rw-r--r--. 1 7155 wheel&& 4571173 Mar 26 03:57 MySQL-devel-5.6.24-1.linux_glibc2.5.x86_64.rpm-rw-r--r--. 1 7155 wheel
Mar 26 03:57 MySQL-embedded-5.6.24-1.linux_glibc2.5.x86_64.rpm-rw-r--r--. 1 7155 wheel&
Mar 26 03:58 MySQL-server-5.6.24-1.linux_glibc2.5.x86_64.rpm-rw-r--r--. 1 7155 wheel&& 2410130 Mar 26 03:59 MySQL-shared-5.6.24-1.linux_glibc2.5.x86_64.rpm-rw-r--r--. 1 7155 wheel&& 5180642 Mar 26 03:59 MySQL-shared-compat-5.6.24-1.linux_glibc2.5.x86_64.rpm-rw-r--r--. 1 7155 wheel&
Mar 26 03:59 MySQL-test-5.6.24-1.linux_glibc2.5.x86_64.rpm
[root@localhost Linux]# chmod 744 -R MySQL[root@localhost Linux]# cd MySQL/
[root@localhost MySQL]# lltotal 622244-rwxr--r--. 1 root root&
May 26 02:11 MySQL-5.6.24-1.linux_glibc2.5.x86_64.rpm-bundle.tar-rwxr--r--. 1 7155 wheel&
Mar 26 03:57 MySQL-client-5.6.24-1.linux_glibc2.5.x86_64.rpm-rwxr--r--. 1 root root&&& 3848304 May 26 02:11 mysql-connector-java-5.1.35.tar.gz-rwxr--r--. 1 7155 wheel&& 4571173 Mar 26 03:57 MySQL-devel-5.6.24-1.linux_glibc2.5.x86_64.rpm-rwxr--r--. 1 7155 wheel
Mar 26 03:57 MySQL-embedded-5.6.24-1.linux_glibc2.5.x86_64.rpm-rwxr--r--. 1 7155 wheel&
Mar 26 03:58 MySQL-server-5.6.24-1.linux_glibc2.5.x86_64.rpm-rwxr--r--. 1 7155 wheel&& 2410130 Mar 26 03:59 MySQL-shared-5.6.24-1.linux_glibc2.5.x86_64.rpm-rwxr--r--. 1 7155 wheel&& 5180642 Mar 26 03:59 MySQL-shared-compat-5.6.24-1.linux_glibc2.5.x86_64.rpm-rwxr--r--. 1 7155 wheel&
Mar 26 03:59 MySQL-test-5.6.24-1.linux_glibc2.5.x86_64.rpm
d. 安装Mysql-server
[root@localhost MySQL]# rpm -ivh MySQL-server-5.6.24-1.linux_glibc2.5.x86_64.rpm
Preparing... ########################################### [100%]
file /usr/share/mysql/charsets/README from install of MySQL-server-5.6.24-1.linux_glibc2.5.x86_64 conflicts with file from package mysql-libs-5.1.71-1.el6.x86_64
file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.6.24-1.linux_glibc2.5.x86_64 conflicts with file from package mysql-libs-5.1.71-1.el6.x86_64
file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.6.24-1.linux_glibc2.5.x86_64 conflicts with file from package mysql-libs-5.1.71-1.el6.x86_64
注:上面的报错信息意思是要安装的文件 MySQL-server-5.6.24-1.linux_glibc2.5.x86_64和系统文件mysql-libs-5.1.71-1.el6.x86_64有冲突
解决办法如下:
先查看系统下有哪些包含MySQL字符串的包,再把查到的mysql-libs-*这个包卸载掉。
[root@localhost ~]# rpm -qa |grep -i mysql&&&&&&&&&&&&&&&&&&&&&&&&&&注:查看系统下有哪些包含MySQL字符串的包
mysql-libs-5.1.71-1.el6.x86_64
[root@localhost ~]#
[root@localhost ~]# rpm -ev --nodeps mysql-libs-5.1.71-1.el6.x86_64&&&&&&&&&&&&&&&注:卸载mysql-libs-5.1.71-1.el6.x86_64包
[root@localhost ~]# cd /root/Linux/MySQL/
[root@localhost MySQL]# ls
MySQL-5.6.24-1.linux_glibc2.5.x86_64.rpm-bundle.tar
MySQL-client-5.6.24-1.linux_glibc2.5.x86_64.rpm
mysql-connector-java-5.1.35.tar.gz
MySQL-devel-5.6.24-1.linux_glibc2.5.x86_64.rpm
MySQL-embedded-5.6.24-1.linux_glibc2.5.x86_64.rpm
MySQL-server-5.6.24-1.linux_glibc2.5.x86_64.rpm
MySQL-shared-5.6.24-1.linux_glibc2.5.x86_64.rpm
MySQL-shared-compat-5.6.24-1.linux_glibc2.5.x86_64.rpm
MySQL-test-5.6.24-1.linux_glibc2.5.x86_64.rpm
[root@localhost MySQL]# rpm -ivh MySQL-server-5.6.24-1.linux_glibc2.5.x86_64.rpm&&&&&&&&&&&&&&&&&&&&&&&&&&&& 注:安装MySQL-server
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
03:50:44 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
03:50:44 0 [Note] /usr/sbin/mysqld (mysqld 5.6.24) starting as process 2931 ...
03:50:44 2931 [Note] InnoDB: Using atomics to ref count buffer pool pages
03:50:44 2931 [Note] InnoDB: The InnoDB memory heap is disabled
03:50:44 2931 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in ‘/root/.mysql_secret‘.&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&注:root用户的mysql密码在这个文件中‘/root/.mysql_secret‘,第一次连接Mysql必须更改密码
You must change that password on your first connect,
no other statement but ‘SET PASSWORD‘ will be accepted.
See the manual for the semantics of the ‘password expired‘ flag.
e. 安装MySQL-Client
[root@localhost MySQL]# rpm -ivh MySQL-client-5.6.24-1.linux_glibc2.5.x86_64.rpm
Preparing... ########################################### [100%]&&&&&
package MySQL-client-5.6.24-1.linux_glibc2.5.x86_64 is already installed
[root@localhost MySQL]#
f. 创建mysql组
[root@localhost MySQL]# groupadd mysql
创建mysql用户,并添加到mysql组中
[root@localhost MySQL]# useradd -g mysql mysql
g. 查看root密码
[root@localhost mysql]# more /root/.mysql_secret
# The random password set for the root user at Tue May 26 03:50:49 2015 (local time
): fB0j9h3IOFdT9nf5&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&注:初始密码,fB0j9h3IOFdT9nf5
h. 查看MySQL的安装目录
[root@localhost mysql]# whereis mysql
mysql: /usr/bin/mysql /usr/lib64/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
i. 查看Mysql的运行目录
[root@localhost MySQL]# which mysql/usr/bin/mysql
3. 启动MySQL
a. 启动Mysql服务
[root@localhost MySQL]# service mysql startStarting MySQL SUCCESS!
b. 查看Mysql是否启动
[root@localhost MySQL]# ps -ef | grep mysqlroot&&&&&& 1904&&&&& 1& 0 18:53 ?&&&&&&& 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.localdomain.pidmysql&&&&& 2032&& :53 ?&&&&&&& 00:00:09 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/localhost.localdomain.err --pid-file=/var/lib/mysql/localhost.localdomain.pidroot&&&&&& 3797&& :05 pts/0&&& 00:00:00 grep mysql
usr/bin/mysql 是指:mysql的运行路径
var/lib/mysql 是指:mysql数据库文件的存放路径
usr/lib/mysql 是指:mysql的安装路径
c. 查看正在运行的端口号
[root@localhost mysql]# netstat -anp |more
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
1668/cupsd
tcp 0 0 127.0.0.1:199 0.0.0.0:* LISTEN
1826/snmpd
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::1:631 :::* LISTEN
1668/cupsd
tcp 0 0 :::3306 :::* LISTEN&&&&&&&&&&&&&&&&&&&&&&注:3306是Mysql默认的端口号
2004/mysqld
udp 0 0 0.0.0.0:631 0.0.0.0:*
d. 首次启动Mysql
[root@localhost mysql]# more /root/.mysql_secret&&&&&&&&&注:root用户的mysql初始密码
# The random password set for the root user at Tue May 26 03:50:49 2015 (local time
): fB0j9h3IOFdT9nf5
[root@localhost mysql]# mysql -h node2 -uroot -pfB0j9h3IOFdT9nf5
Warning: Using a password on the command line interface can be insecure.
ERROR 2005 (HY000): Unknown MySQL server host ‘node2‘ (111) 报错&&&&&&&&&&&&&&&&注:找不到node2
将node2换成127.0.0.1
[root@localhost mysql]# mysql -h127.0.0.1 -uroot -pfB0j9h3IOFdT9nf5
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. C or \g.
Your MySQL connection id is 2
Server version: 5.6.24
Copyright (c) , Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
Type ‘‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
mysql&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&注:MySQL已启动
e. 更改root密码为mysql
mysql& set password=password(‘mysql‘);&&&&&&&&&&&&& 注:命令最后有分号
Query OK, 0 rows affected (0.09 sec)
mysql&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&& 注:&刷新权限
Query OK, 0 rows affected (0.00 sec)
f. 查看数据库
+--------------------+
| Database |
+--------------------+
| information_schema |
| performance_schema |
+--------------------+
4 rows in set (0.09 sec)
mysql& exit&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&注:退出MySQL,自动切换至Linux root用户
[root@localhost mysql]#
&&标签:&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&& &&&&&&
&& &&&&&&&&&&&&
版权所有 鲁ICP备号-4
打开技术之扣,分享程序人生!Navigation
您所在的位置:
& BSD/Linux下的安装测试
Page&1&of&6
日,Sphinx 2.2.1-beta 与 2.1.3-release 发布;CoreSeek即将发布CoreSeek5.
日,Sphinx 2.0.2-beta 测试版发布;CoreSeek版本正在紧张开发中,最新版本的中文手册也在紧张翻译中。
基于Sphinx 2.0.2-dev版本发布,增加了和完善很多功能,主要亮点如下:
实时索引支持
searchd直接支持MySQL协议
SphinxQL接口查询进一步完善
Python数据源进一步完善
增加sql_query_info_pre指令【4.0.1开始支持,详情查看】
升级SphinxSE的MySQL支持,支持MySQL 5.5.15及以上版本
升级SphinxSE为2.0.2-dev版本,支持字符串属性
附加资料:
最新中文手册,
Python数据源说明
MySQL/SphinxSE Windows版本
PHP、Python、Perl、Java、C/C++、C#/.NET等API接口
BSD/Linux下的安装测试
CoreSeek快速安装:
安装前,建议查看:;4.0/4.1版可参考3.2版本安装,步骤相同;如遇到问题,请看详细安装说明。
##下载coreseek:coreseek 3.2.14:、coreseek 4.0.1:、coreseek 4.1:
$ wget /uploads/csft/3.2/coreseek-3.2.14.tar.gz
$ 或者 /uploads/csft/4.0/coreseek-4.0.1-beta.tar.gz
$ 或者 /uploads/csft/4.0/coreseek-4.1-beta.tar.gz
$ tar xzvf coreseek-3.2.14.tar.gz 或者 coreseek-4.0.1-beta.tar.gz 或者 coreseek-4.1-beta.tar.gz
$ cd coreseek-3.2.14 或者 coreseek-4.0.1-beta 或者 coreseek-4.1-beta
##前提:需提前安装及mysql依赖库以支持mysql数据源和xml数据源
##安装mmseg
$ cd mmseg-3.2.14
$ ./bootstrap
#输出的warning信息可以忽略,如果出现error则需要解决
$ ./configure --prefix=/usr/local/mmseg3
$ make && make install
##安装coreseek
$ cd csft-3.2.14 或者 cd csft-4.0.1 或者 cd csft-4.1
$ sh buildconf.sh
#输出的warning信息可以忽略,如果出现error则需要解决
$ ./configure --prefix=/usr/local/coreseek
--without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-mysql
##如果提示mysql问题,可以
$ make && make install
##测试mmseg分词,coreseek搜索(需要预先设置好字符集为zh_CN.UTF-8,确保正确显示中文)
$ cd testpack
$ cat var/test/test.xml
#此时应该正确显示中文
$ /usr/local/mmseg3/bin/mmseg -d /usr/local/mmseg3/etc var/test/test.xml
$ /usr/local/coreseek/bin/indexer -c etc/csft.conf --all
$ /usr/local/coreseek/bin/search -c etc/csft.conf 网络搜索
CoreSeek详细安装:
##详细安装测试说明文档
##如果您觉得以下步骤太麻烦,请即刻进入火线技术支持:
##以下文档,对32位(x86)、64位(amd64、x64)均可适用
##安装前,请查看以下列表对应操作系统页面,安装需要预先安装的软件,以便后续安装测试可正常进行!
##依赖环境建议版本:(源码升级可参考)
m4 &= 1.4.13
autoconf &= 2.65
automake &= 1.11
libtool &= 2.2.6b
Coreseek 安装测试BSD/Linux系统环境大全(内含需预装的软件列表和命令):
(32位与64位均实际测试支持)
(32位与64位均实际测试支持)
(32位与64位均实际测试支持)
(32位与64位均实际测试支持)
(32位与64位均实际测试支持)
(32位与64位均实际测试支持)
(32位实际测试支持,64位支持)
(32位与64位均实际测试支持)
(32位实际测试支持,64位支持)
(32位实际测试支持,64位支持)
(32位与64位均实际测试支持)
(32位实际测试支持,64位支持)
(32位与64位均实际测试支持)
(32位实际测试支持,64位支持)
(32位实际测试支持,64位支持)
(32位实际测试支持,64位支持)
(32位与64位均实际测试支持)
##一、基础安装:(此时尚不支持MySQL,完成第二步数据源支持后就支持)
##完成后:提供xml数据源支持,中文检索支持
##download
$ tar xzvf coreseek-3.2.14.tar.gz
$ 请点击仔细查看
##切换到root用户,确保拥有完整的权限来安装软件
$ sudo root bash
$ cd coreseek-3.2.14
##中文测试环境检查:
##以下为核心项,locale为zh_CN.UTF-8,就可以正常显示和输入中文;locale设置功能由操作系统自身支持,BSD/Linux均可开启;该功能,不是coreseek提供的!!!
##如果不能正常显示中文,则后面的中文测试部分无法正常进行,但不会影响coreseek的实际功能;
LANG=zh_CN.UTF-8
LC_ALL="zh_CN.UTF-8"
##如果显示的不是zh_CN.UTF-8,请参考以下网址进行设置:
##确保可以正常显示,否则请检查当前环境的locale配置,以及当前环境或者客户端已设置好支持UTF-8中文字符显示
$ cat testpack/var/test/test.xml
##安装coreseek开发的mmseg,为coreseek提供中文分词功能
$ cd mmseg-3.2.14
##ubuntu环境下,需要使用ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap
$ ./bootstrap
$ ./configure --prefix=/usr/local/mmseg3
$ make && make install
##如果提示libtool: unrecognized option `--tag=CC' ,请查看
##安装完成后,mmseg使用的词典和配置文件,将自动安装到/usr/local/mmseg3/etc中
##中文分词测试,如果显示不正常,请检查当前环境下的locale和UTF-8中文字符显示设置
/usr/local/mmseg3/bin/mmseg -d /usr/local/mmseg3/etc src/t1.txt
中文/x 分/x 词/x 测试/x
中国人/x 上海市/x
Word Splite took: 1 ms.
##安装coreseek:
$ cd csft-3.2.14
##执行configure,进行编译配置:
$ sh buildconf.sh
$ ./configure --prefix=/usr/local/coreseek --without-python --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --without-mysql
##coreseek4.x/sphinx1.x,请将--without-mysql更改为--with-mysql
$ make && make install
##如果提示mysql问题,可以
##可能遇到的问题:
##如果提示libtool: unrecognized option `--tag=CC' ,请查看
##有的系统下可能出现:expected `;' before ‘CSphTokenizer_UTF8SpaceSeg’,
##或者出现:configure: WARNING: unrecognized options: --with-mmseg, --with-mmseg-includes, --with-mmseg-libs
##是因为你没有进行随后的sh buildconf.sh操作
##生成当前系统对应的编译配置文件
##需要使用以下指令:
$ sh buildconf.sh
## Linux环境下,如遇到pthread问题,请先直接执行以下指令在进行configur:
$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
$ export LD_LIBRARY_PATH
## 如果出现undefined reference to `libiconv'的类似错误,可以按照如下方法处理:
##方法一:(Linux使用)
## 直接执行:export LIBS="-liconv"
##然后make clean,再次configure后,进行编译安装make && make install
## 方法二:
## 首先configure,然后vim src/makefile
## 在其中搜索lexpat,在其后加上 -liconv
## 修改后该行应该为:-lexpat -liconv -L/usr/local/lib
## 然后再次make && make install
## 方法三:
## 首先configure,然后vim config/config.h
## 在其中搜索USE_LIBICONV,将其后的1修改为0
## 然后再次make && make install
##配置测试,测试是否可以正确运行
$ /usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/sphinx-min.conf.dist
##以下为正常测试时的提示信息:
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) ,
Beijing Choice Software Technologies Inc ()
using config file '/usr/local/coreseek/etc/sphinx-min.conf.dist'...
total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
##csft-4.0版显示:ERROR: nothing to do.
##至此,coreseek基础环境可以正常安装,我们可以开始后续的工作啦。
##注意:基础环境仅支持xml数据源;如需要mysql或者python数据源,请继续按照下面的步骤操作!!!
##二、数据源支持:支持MySQL数据源
##完成后:提供mysql数据源支持和xml数据源支持
##系统需要安装相关的基础依赖库,否则无法支持对应的功能
##freebsd6/7/8:
$ pkg_add -r mysql50-client libxml2 expat
##centos5.4/5.5: fedora12/13 : rhel5.5
$ yum install mysql-devel libxml2-devel expat-devel
##debian5 : ubuntu9/10:
$ apt-get install mysql-client libmysqlclient15-dev
libxml2-dev libexpat1-dev
##gentoo10:
##安装环境自带了libmysqlclient libxml2 libexpat
##opensuse10/11:
##yast安装 libmysqlclient-devel libxml2 libxml2-devel libexpat-devel
##slackware13.0/13.1:
$ slapt-get --install mysql libxml2 expat
##archlinux-2010:
$ pacman -S libmysqlclient
libxml2 expat
##重新编译安装coreseek,以支持mysql数据源和xml数据源
$ cd csft-3.2.14
$ make clean
$ ./configure --prefix=/usr/local/coreseek
--without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-mysql
##以上configure参数请正确拷贝,不要遗漏或者随意修改
$ make && make install
##如果出现错误提示:“ERROR: cannot find MySQL include files.......To disable MySQL support, use --without-mysql option.“,可按照如下方法处理:
##请找到头文件mysql.h所在的目录,一般是/usr/local/mysql/include,请替换为实际的
##请找到库文件libmysqlclient.a所在的目录,一般是/usr/local/mysql/lib,请替换为实际的
##configure参数加上:--with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib,执行后,重新编译安装
##三、coreseek中文全文检索测试
$ cd testpack
/usr/local/coreseek/bin/indexer -c etc/csft.conf
##以下为正常情况下的提示信息:
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) ,
Beijing Choice Software Technologies Inc ()
using config file 'etc/csft.conf'...
total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
##csft-4.0版显示:ERROR: nothing to do.
/usr/local/coreseek/bin/indexer -c etc/csft.conf --all
##以下为正常索引全部数据时的提示信息:(csft-4.0版类似)
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) ,
Beijing Choice Software Technologies Inc ()
using config file 'etc/csft.conf'...
indexing index 'xml'...
collected 3 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 3 docs, 7585 bytes
total 0.075 sec, 101043 bytes/sec, 39.96 docs/sec
total 2 reads, 0.000 sec, 5.6 kb/call avg, 0.0 msec/call avg
total 7 writes, 0.000 sec, 3.9 kb/call avg, 0.0 msec/call avg
/usr/local/coreseek/bin/indexer -c etc/csft.conf xml
##以下为正常索引指定数据时的提示信息:(csft-4.0版类似)
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) ,
Beijing Choice Software Technologies Inc ()
using config file 'etc/csft.conf'...
indexing index 'xml'...
collected 3 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 3 docs, 7585 bytes
total 0.069 sec, 109614 bytes/sec, 43.35 docs/sec
total 2 reads, 0.000 sec, 5.6 kb/call avg, 0.0 msec/call avg
total 7 writes, 0.000 sec, 3.9 kb/call avg, 0.0 msec/call avg
/usr/local/coreseek/bin/search -c etc/csft.conf
##以下为正常测试搜索时的提示信息:(csft-4.0版类似)
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) ,
Beijing Choice Software Technologies Inc ()
using config file 'etc/csft.conf'...
index 'xml': query '': returned 3 matches of 3 total in 0.093 sec
displaying matches:
1. document=1, weight=1, published=Thu Apr
1 22:20:07 2010, author_id=1
2. document=2, weight=1, published=Thu Apr
1 23:25:48 2010, author_id=1
3. document=3, weight=1, published=Thu Apr
1 12:01:00 2010, author_id=2
/usr/local/coreseek/bin/search -c etc/csft.conf -a Twittter和Opera都提供了搜索服务
##以下为正常测试搜索关键词时的提示信息:(csft-4.0版类似)
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) ,
Beijing Choice Software Technologies Inc ()
using config file 'etc/csft.conf'...
index 'xml': query 'Twittter和Opera都提供了搜索服务 ': returned 3 matches of 3 total in 0.038 sec
displaying matches:
1. document=3, weight=24, published=Thu Apr
1 12:01:00 2010, author_id=2
2. document=1, weight=4, published=Thu Apr
1 22:20:07 2010, author_id=1
3. document=2, weight=3, published=Thu Apr
1 23:25:48 2010, author_id=1
1. 'twittter': 1 documents, 3 hits
2. '和': 3 documents, 15 hits
3. 'opera': 1 documents, 25 hits
4. '都': 2 documents, 4 hits
5. '提供': 0 documents, 0 hits
6. '了': 3 documents, 18 hits
7. '搜索': 2 documents, 5 hits
8. '服务': 1 documents, 1 hits
/usr/local/coreseek/bin/searchd -c etc/csft.conf
##以下为正常开启搜索服务时的提示信息:(csft-4.0版类似)
Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
Copyright (c) ,
Beijing Choice Software Technologies Inc ()
using config file 'etc/csft.conf'...
listening on all interfaces, port=9312
##如要停止搜索服务,请使用/usr/local/coreseek/bin/searchd -c etc/csft.conf --stop
##如要已启动服务,要更新索引,请使用/usr/local/coreseek/bin/indexer -c etc/csft.conf --all --rotate
##然后,请参考csft-3.2.14下api目录中的相关文件,使用PHP、Python、Ruby、Java来测试搜索服务;也可以前往搜索服务建立三步曲,查看第三步使用PHP测试。
##四、继续
##通过以上步骤,coreseek已经安装测试完成,可以提供正常的xml数据源索引以及提供对应的搜索服务了
##下一步工作,请查看手册,准备好mysql数据信息,以及进行mysql数据源的测试,并在您的应用中调用搜索服务;mysql数据源的配置可参考testpack/etc/csft_mysql.conf文件
##如有问题,请前往: 提问,我们将在第一时间解答
##如果您需要获得专业的支持,请前往: 与我们取得联系,洽谈支持与合作事宜
##祝您使用快乐!!!
##五、python数据源支持:
##FreeBSD操作系统:
$ cd /usr/ports/lang/python26;make install clean
##FreeBSD7/8也可以执行pkg_add -r python26快速安装
##正常情况下提示:
Python 2.6.4 (r264:75706, Feb 17 :15)
[GCC 4.2.1
[FreeBSD]] on freebsd7
Type "help", "copyright", "credits" or "license" for more information.
##按ctrl+D退出python2.6
##Linux操作系统:
##安装Python 2.6
##将Python-2.6.tgz解压后,直接编译安装
$ ./configure
$ make && make install
$ /usr/local/bin/python2.6
##正常情况下提示:
Python 2.6 (r26:66714, Mar 20 :58)
[GCC 4.1.2
(Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
##按ctrl+D退出python2.6
$ mv /usr/bin/python /usr/bin/python.old
$ ln -s /usr/local/bin/python2.6 /usr/bin/python
$ /usr/bin/python
##此时应该出现与运行/usr/local/bin/python2.6一致的提示,表示python2.6环境安装成功
$ export LIBS="-ldl -lutil -Xlinker -export-dynamic"
##Linux系统下设置python编译参数,不设置可能导致下面编译make时失败!
##使用yum的系统,请将/usr/bin/yum第一行的调用修改为#!/usr/bin/python.old,确保yum可以正常使用
##重新安装coreseek,以支持mysql数据源、xml数据源和python数据源
$ cd csft-3.2.14
$ ./configure --prefix=/usr/local/coreseek
--without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-python
$ make && make install
##python 数据源安装支持完成。
##如果您对python数据源有实际需求,可以查看获取具体细节!
##python数据源演示(测试索引前,请先测试脚本自身是否可以正确操作读取数据):、
源码包内容说明:
目录说明:
csft-x.y.z:coreseek源代码
mmseg-i.j.k:mmseg源代码
testpack:测试配置和数据包
testpack测试说明:
目录说明:
api:api接口和测试脚本
etc:配置文件
etc/pysource:python数据源脚本
var:运行数据
var/data:索引文件
var/log:搜索日志
var/test:测试源数据
csft 通用测试:(3.2.x与4.x均支持)
测试对象:xml数据源,中文分词与搜索
对应配置:etc/csft.conf
测试数据:var/test/test.xml
PHP程序:api/test_coreseek.php
在线说明:
测试对象:xml数据源,单字切分与搜索
对应配置:etc/csft_cjk.conf
测试数据:var/test/test.xml
PHP程序:api/test_coreseek.php
在线说明:
测试对象:mysql数据源,中文分词与搜索
对应配置:etc/csft_mysql.conf
测试数据:var/test/documents.sql
PHP程序:api/test_coreseek.php
测试说明:请先将测试数据导入数据库,并设置好配置文件中的MySQL用户密码数据库
在线说明:
测试对象:python数据源,中文分词与搜索
对应配置:etc/csft_demo_python.conf
数据脚本:etc/pysource/csft_demo/__init__.py
PHP程序:api/test_coreseek.php
测试说明:请先安装Python 2.6 (x86)
在线说明:
测试对象:python+mssql数据源,中文分词与搜索
对应配置:etc/csft_demo_python_pymssql.conf
数据脚本:etc/pysource/csft_demo_pymssql/__init__.py
PHP程序:api/test_coreseek.php
测试说明:请先安装Python 2.6 (x86)、pymssql(py2.6)
在线说明:
coreseek-4.y.z 新增测试:
测试对象:RT实时索引,中文分词与搜索
对应配置:etc/csft_rtindex.conf
PHP程序:api/test_coreseek_rtindex.php
在线说明:
测试对象:RT实时索引,单字切分与搜索
对应配置:etc/csft_rtindex_cjk.conf
PHP程序:api/test_coreseek_rtindex.php
在线说明:}

我要回帖

更多关于 linux mysql 安装配置 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信