如何知道Joomla数据库在哪里?

时间:2016-04-27 04:52:05

标签: joomla connection

我从其他人那里用joomla写了一个项目。我不和joomla合作。

如何查找数据库以及如何将其添加到项目中?  这是configuration.php的一部分:

public $user = 'png';
public $password = 'pass';
public $db = 'db_name';

我检查了configuration.php,我在phpmyadmin中创建了一个具有相同名称(' db_name')的数据库(没有他们的表)但数据库连接错误。为什么?

2 个答案:

答案 0 :(得分:1)

您还需要主机名。 configuration.php文件中的相关行如下:

public $host = 'host_name';
public $user = 'db_user;
public $password = 'db_password*';
public $db = 'db_name';
public $dbprefix = 'db_prefix';

设置public $host = 'localhost';,您还需要将Joomla数据库表还原到数据库,然后才能成功建立连接。

您可以从原始位置导出数据库表,并使用phpMyAdmin或类似方法将它们导入新数据库。或者,您可以使用Akeeba备份来备份原始位置上的文件和数据库,然后使用Kickstart将这些备份还原到本地主机。 Akeeba Backup和Kickstart是免费的。

答案 1 :(得分:0)

运行Joomla安装时,会创建configuration.php。如果您在本地主机上,那么您的数据库将成为" localhost"。

我建议仔细检查PHPMyAdmin以验证数据库名称,用户名和密码。当我运行localhost时,我的configuration.php通常如下所示:

    {"statusLine":{"reasonPhrase":"OK","protocolVersion":{"protocol":"HTTP","major":1,"minor":1},"statusCode":200},"allHeaders":[{"valuePos":14,"elements":[{"parameterCount":0,"name":"no-cache","parameters":[]},{"parameterCount":0,"name":"no-store","parameters":[]},{"parameterCount":0,"name":"must-revalidate","parameters":[]},{"parameterCount":0,"name":"pre-check","value":"0","parameters":[]},{"parameterCount":0,"name":"post-check","value":"0","parameters":[]}],"name":"cache-control","buffer":{"empty":false,"full":false},"value":"no-cache, no-store, must-revalidate, pre-check=0, post-check=0"},{"valuePos":20,"elements":[{"parameterCount":1,"name":"attachment","parameters":[{"name":"filename","value":"json.json"}]}],"name":"content-disposition","buffer":{"empty":false,"full":false},"value":"attachment; filename=json.json"},{"valuePos":15,"elements":[{"parameterCount":0,"name":"7037","parameters":[]}],"name":"content-length","buffer":{"empty":false,"full":false},"value":"7037"},{"valuePos":13,"elements":[{"parameterCount":1,"name":"application/json","parameters":[{"name":"charset","value":"utf-8"}]}],"name":"content-type","buffer":{"empty":false,"full":false},"value":"application/json;charset=utf-8"},{"valuePos":5,"elements":[{"parameterCount":0,"name":"Wed","parameters":[]},{"parameterCount":0,"name":"27 Apr 2016 17:27:40 GMT","parameters":[]}],"name":"date","buffer":{"empty":false,"full":false},"value":"Wed, 27 Apr 2016 17:27:40 GMT"},{"valuePos":8,"elements":[{"parameterCount":0,"name":"Tue","parameters":[]},{"parameterCount":0,"name":"31 Mar 1981 05:00:00 GMT","parameters":[]}],"name":"expires","buffer":{"empty":false,"full":false},"value":"Tue, 31 Mar 1981 05:00:00 GMT"},{"valuePos":14,"elements":[{"parameterCount":0,"name":"Wed","parameters":[]},{"parameterCount":0,"name":"27 Apr 2016 17:27:40 GMT","parameters":[]}],"name":"last-modified","buffer":{"empty":false,"full":false},"value":"Wed, 27 Apr 2016 17:27:40 GMT"},{"valuePos":7,"elements":[{"parameterCount":0,"name":"no-cache","parameters":[]}],"name":"pragma","buffer":{"empty":false,"full":false},"value":"no-cache"},{"valuePos":7,"elements":[{"parameterCount":0,"name":"tsa_a","parameters":[]}],"name":"server","buffer":{"empty":false,"full":false},"value":"tsa_a"},{"valuePos":11,"elements":[{"parameterCount":1,"name":"lang","value":"en","parameters":[{"name":"Path","value":"/"}]}],"name":"set-cookie","buffer":{"empty":false,"full":false},"value":"lang=en; Path=/"},{"valuePos":11,"elements":[{"parameterCount":3,"name":"guest_id","value":"v1%3A146177806078426763","parameters":[{"name":"Domain","value":".twitter.com"},{"name":"Path","value":"/"},{"name":"Expires","value":"Fri"}]},{"parameterCount":0,"name":"27-Apr-2018 17:27:40 UTC","parameters":[]}],"name":"set-cookie","buffer":{"empty":false,"full":false},"value":"guest_id=v1%3A146177806078426763; Domain=.twitter.com; Path=/; Expires=Fri, 27-Apr-2018 17:27:40 UTC"},{"valuePos":7,"elements":[{"parameterCount":0,"name":"200 OK","parameters":[]}],"name":"status","buffer":{"empty":false,"full":false},"value":"200 OK"},{"valuePos":26,"elements":[{"parameterCount":0,"name":"max-age","value":"631138519","parameters":[]}],"name":"strict-transport-security","buffer":{"empty":false,"full":false},"value":"max-age=631138519"},{"valuePos":15,"elements":[{"parameterCount":0,"name":"read-write","parameters":[]}],"name":"x-access-level","buffer":{"empty":false,"full":false},"value":"read-write"},{"valuePos":18,"elements":[{"parameterCount":0,"name":"3454ef82d8d78c83570609a400be310e","parameters":[]}],"name":"x-connection-hash","buffer":{"empty":false,"full":false},"value":"3454ef82d8d78c83570609a400be310e"},{"valuePos":23,"elements":[{"parameterCount":0,"name":"nosniff","parameters":[]}],"name":"x-content-type-options","buffer":{"empty":false,"full":false},"value":"nosniff"},{"valuePos":16,"elements":[{"parameterCount":0,"name":"SAMEORIGIN","parameters":[]}],"name":"x-frame-options","buffer":{"empty":false,"full":false},"value":"SAMEORIGIN"},{"valuePos":19,"elements":[{"parameterCount":0,"name":"180","parameters":[]}],"name":"x-rate-limit-limit","buffer":{"empty":false,"full":false},"value":"180"},{"valuePos":23,"elements":[{"parameterCount":0,"name":"179","parameters":[]}],"name":"x-rate-limit-remaining","buffer":{"empty":false,"full":false},"value":"179"},{"valuePos":19,"elements":[{"parameterCount":0,"name":"1461778960","parameters":[]}],"name":"x-rate-limit-reset","buffer":{"empty":false,"full":false},"value":"1461778960"},{"valuePos":16,"elements":[{"parameterCount":0,"name":"48","parameters":[]}],"name":"x-response-time","buffer":{"empty":false,"full":false},"value":"48"},{"valuePos":14,"elements":[{"parameterCount":0,"name":"d4ec12da2dc12a43","parameters":[]}],"name":"x-transaction","buffer":{"empty":false,"full":false},"value":"d4ec12da2dc12a43"},{"valuePos":24,"elements":[{"parameterCount":0,"name":"BouncerCompliant","parameters":[]}],"name":"x-twitter-response-tags","buffer":{"empty":false,"full":false},"value":"BouncerCompliant"},{"valuePos":17,"elements":[{"parameterCount":1,"name":"1","parameters":[{"name":"mode","value":"block"}]}],"name":"x-xss-protection","buffer":{"empty":false,"full":false},"value":"1; mode=block"}],"protocolVersion":{"protocol":"HTTP","major":1,"minor":1},"locale":"en_US","params":{"clientParams":{},"requestParams":{}},"entity":{"streaming":true,"repeatable":false,"chunked":false,"contentLength":7037,"contentType":{"valuePos":13,"elements":[{"parameterCount":1,"name":"application/json","parameters":[{"name":"charset","value":"utf-8"}]}],"name":"content-type","buffer":{"empty":false,"full":false},"value":"application/json;charset=utf-8"},"content":{}}}