如何在我的网站上添加Sphider搜索? “无法连接到数据库" [英] How to add Sphider search to my website? "Cannot connect to database"

查看:78
本文介绍了如何在我的网站上添加Sphider搜索? “无法连接到数据库"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了 Sphider搜索引擎,目前我正在尝试通过本地主机运行它.我将其提取到根文件夹中,并在HTML中创建了一个搜索栏:

I downloaded the Sphider search engine and I am currently trying to run it via my localhost. I extracted it in my root folder and made a search bar in HTML:

<div id="searchwrapper">
<form action="../sphider-1.3.5/search.php" method="get" title="eurobytes search">
<input type="text" class="searchbox" name="s" value="" action="../sphider-1.3.5/include/js_suggest/suggest.php" columns="2" autocomplete="off" delay="1500" bgcolor="transparent"/>
<input type="hidden" name="search" value="1">
<input type="image" src="../images/search.png" height="15" class="searchbox_submit" value="search" />
</form>
</div>

但是当我输入一些内容时,会出现此错误:

but when I type something in I get this error:

无法连接到数据库,请检查用户名,密码和主机是否正确.

Cannot connect to database, check if username, password and host are correct.

我是MySQL的新手,我在sphider-1.3.5文件夹中阅读了install.txt,并执行了以下操作:

I am pretty new to MySQL I read the install.txt, in the sphider-1.3.5 folder, and did the following:

mysql -u您的用户名-p出现提示时输入密码. b)在 MySQL,键入:CREATE DATABASE sphider_db;

mysql -u your username -p Enter your password when prompted. b) in MySQL, type: CREATE DATABASE sphider_db;

但是,当我键入CREATE DATABASE sphider_db时,我得到了:

But, when I type in CREATE DATABASE sphider_db I get this:

我现在不知道要输入什么.我尝试了sphider_db exit,但是什么也没发生?

I don't know what to type now. I tried sphider_db exit but nothing happens?

很抱歉,如果这个问题对大多数人来说是常识,但我刚开始使用MySQL/Sphider.

Sorry if this problem is common sense to most, but I just started playing with MySQL/Sphider.

推荐答案

您是否编辑过settings/database.php?听起来像是配置问题... 这是开始故障排除的两个步骤:

Have you edited settings/database.php? Sounds like a configuration issue... Here are 2 steps to start troubleshooting:

  1. 检查您的数据库名称,用户名和密码是什么.
  2. 确保已使用该信息编辑了database.php.

这是来自database.php的代码段,您需要使用数据库设置和用户凭据(v1.3.5)进行编辑

Here is the code snippet from database.php you need to edit with your db settings and user credentials (v1.3.5)

/*********************** 
Database 1 settings
***********************/

// Name of database
$database1 = "test";

// MySQL User
$mysql_user1 = "test-user";

// MySQL Password
$mysql_password1 = "test-user-pw";

// MySQL Host
$mysql_host1 = "localhost";

 // Prefix for tables
$mysql_table_prefix1 = "test_";

// Status of database
$db1_set = "1";

这篇关于如何在我的网站上添加Sphider搜索? “无法连接到数据库"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆