Codeigniter:在Windows XP中显示错误为“无法选择指定的数据库:项目” [英] Codeigniter : Showing error as ' Unable to select the specified database: project' in Windows XP

查看:362
本文介绍了Codeigniter:在Windows XP中显示错误为“无法选择指定的数据库:项目”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Windows XP并使用EasyPHP作为服务器。我已经整合Codeigniter与TankAuth。但是,当我尝试打开我的任务文件夹时,它显示错误如下:

 无法选择指定的数据库:project 

文件名:C:\Program Files\EasyPHP-12.1\www\assignment\system\database\DB_driver.php

行号:140

我的数据库.php中的代码如下

  $ active_group ='default'; 
$ active_record = TRUE;

$ db ['default'] ['hostname'] = 'localhost';
$ db ['default'] ['username'] ='root';
$ db ['default'] ['password'] ='root123';
$ db ['default'] ['database'] ='project';
$ 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;

我已经检查了我的database.php,里面有数据库名称为'project'。



我尝试过使用hostname作为'localhost'和'127.0.0.1',但没有工作。



我已将我的默认控制器设置为auth,即TankAuth的默认控制器。



并且在'auth'控制器的构造中初始化了'database'库。



刚才我尝试过使用Wamp Server的同样的事情。但是,得到了相同的结果。



在某个地方我读到,我应该尝试 $ db ['default'] ['pconnect']



$ db ['default'] ['db_debug'] FALSE 。但它没有工作。



并且所有访问权限已授予数据库'项目'。





提前感谢...

解决方案

错误是指它已成功连接到您的数据库软件,但是找不到指定的名为 project 的DB。检查你的数据库连接并确保它们都是正确的 - 这听起来像你的数据库名应该分配



编辑:检查以确保您登录的数据库用户也具有访问指定数据库的权限。


I am using Windows XP and using EasyPHP as a server. I have integrated Codeigniter with TankAuth. But, when I try to open my assignment folder, it shows error as follows:

Unable to select the specified database: project

Filename: C:\Program Files\EasyPHP-12.1\www\assignment\system\database\DB_driver.php

Line Number: 140

The code inside my database .php is as follows"

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = 'root123';
$db['default']['database'] = 'project';
$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;

I have checked my database.php, inside it I have database name as 'project'.

I have tried with hostname both as 'localhost' and as '127.0.0.1', but none worked.

I have set my default controller to 'auth' i.e. default controller of TankAuth.

And have initialized 'database' library in the construct in 'auth' controller.

Just now I have tried the same thing using Wamp Server. But, got the same result.

Somewhere I read that I should try making $db['default']['pconnect'] and

$db['default']['db_debug'] to FALSE. But it didn't work.

And all the access permissions have been granted to database 'project'.

Is there anything that I should try to make it work?

Thanks in advance...

解决方案

The error is stating that it has successfully connected to your database software, but it cannot find the specified DB named project. Check your DB connections and make sure they are all correct -- it sounds like your database name should be assignment instead.

Edit: Check to make sure the DB user your are logging in as has permission to access the specified database, also.

这篇关于Codeigniter:在Windows XP中显示错误为“无法选择指定的数据库:项目”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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