To connect your application with the database, you need to set the database connection details in the database.php file. You can store more than one connection details in this file.
Configuring database in CodeIgniter – Setting connection details
You can set the database connection details in the database.php file located under root_folder_of_your_project->config folder.
Modify the database.php file as shown below:
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost', //server..
'username' => 'root', //database username
'password' => '', //database password
'database' => 'cisite', //Your database name here
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => FALSE
);
Values used
VALUE | DESCRIPTION |
hostname | Specifies the hostname of your database server. In most cases, it is localhost. |
username | Specifies the username of the database. |
password | Specifies the password of the database. |
database | Specifies the database which you are using. |
Specifies an optional table prefix which will be added to the table name when running Query Builder queries. | |
db_debug | Specifies whether the database errors should be displayed. It can have TRUE or FASLE as values. |