【问题标题】:Codeigniter Framework Database ErrorCodeigniter 框架数据库错误
【发布时间】:2016-05-18 10:16:27
【问题描述】:

我在 Codeigniter MVC 框架项目中收到以下错误。

无法使用提供的设置连接到您的数据库服务器。
文件名:C:\xampp\htdocs\citizen\system\database\DB_driver.php
行号:125

知道如何调试它。

【问题讨论】:

标签: php mysql codeigniter model-view-controller


【解决方案1】:

如果你进入 'application/config' 目录并在第 51 行打开 database.php,你会看到

$db['default']['hostname'] = 'The hostname of your database server';
$db['default']['username'] = 'The username used to connect to the database';
$db['default']['password'] = 'The password used to connect to the database';
$db['default']['database'] = 'The name of the database you want to connect to';

填写这些以匹配您的设置。您的主机名将是“localhost”,其余的是您当时设置的。 希望有帮助 问候 基思

【讨论】:

    【解决方案2】:

    只是为了调试你的问题:

    转到system/database/mysql/mysql_driver 并在db_connect 方法中从@mysql_connect($this->hostname, $this->username, $this->password, TRUE); 中删除@

    这会告诉你数据库出了什么问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-23
      • 2014-02-28
      • 2014-03-25
      • 1970-01-01
      • 2014-07-11
      • 1970-01-01
      • 2017-02-17
      • 2016-07-12
      相关资源
      最近更新 更多