0

我正在尝试将我的 codeigniter 网站上传到 cpanel 但是,我收到以下错误:

A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: core/Loader.php
Line Number: 346

我已将所有文件上传到目录:/home/mycpanelusername/public_html/

和,

database name = mycpanelusername_db_databasename
databae username = mycpanelusername_fajs
database password = mydbpassword

我授予了我的数据库的所有权限

我的 database.php 文件是这样的:

$db['default']['hostname'] = 'http://myurl.org';
$db['default']['username'] = 'mycpanelusername_fajs';
$db['default']['password'] = 'mydbpassword';
$db['default']['database'] = 'mycpanelusername_db_databasename';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

谢谢,如果不清楚请追问

4

2 回答 2

1

给 $db['default']['hostname'] 作为 ip 地址

$db['default']['hostname'] ="254.000.0.0";

或者

$db['default']['hostname'] = 'localhost';

试试这样

于 2013-06-11T10:19:58.840 回答
0

尝试使用 localhost 之类的

$db['default']['hostname'] = 'localhost';

是否可以正常工作,并且还可以检查登录凭据和数据库名称

于 2013-06-11T10:09:33.197 回答