Not Found Database Name in codeigniter

DBNAME shows it is define as constant, my guess it must be define in constant.php

You can use grep or notepad++ search in files feature to look for “DBNAME” in whole folder. This way you will get the file where it is define as constant and so the database name you are looking for.

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

$db['default']['hostname'] = DBHOST;
$db['default']['username'] = DBUSER;
$db['default']['password'] = DBPASS;
$db['default']['database'] = DBNAME;
$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;

If you are interested in only db name then in same config file add below line at the top

die(DBNAME);

and hit the any page of the project, it will print the database name.

Leave a Reply

Your email address will not be published. Required fields are marked *