Become Our Fan on Social Sites!

Facebook Twitter

Google+ RSS YouTube

Thursday 20 February 2014

How To Configure Database In CodeIgniter

Hello friends, I am telling you about how to configure/set database in CodeIgniter. CodeIgniter framework contains many configuration files.

HOW TO SET DATABASE IN CODEIGNITER
Database Configuration in CodeIgniter

There are some configuration files listed below:


  • autoload.php
  • config.php
  • constants.php
  • database.php
  • doctypes.php
  • hooks.php
  • mimes.php
  • profiler.php
  • routes.php, etc.

Location/path of CodeIgniter configuration files is
application/config/

Now, we have to configure database so we have to change/update "database.php" configuration file.
Location/path of database.php file is:
application/config/database.php

Database.php file contains few lines of code, some configurations of database.php file are listed below:
  • $db['default']['hostname']='localhost';
  • $db['default']['username']='root';
  • $db['default']['password']=' ';
  • $db['default']['database']='Your Database Name';

There are many other configurations of database, but now for basic configuration for database we have to need only above listed configurations.

Lets begin with first configuration, that is hostname and value of hostname is 'localhost'.

Second configuration is username and by default it is 'root'. If you have other username then specify that username.

Third configuration is password. By default password is blank/empty. If you already set password for your database then give that password otherwise remain it as blank/empty.

Fourth configuration is the most important configuration that is database name. Here you have to specify your database name.

If you have any query regarding configuration of database in CodeIgniter then comment below.

Video Tutorial:

About CodeIgniter

How to Create First Program In CodeIgniter?
CodeIgniter Basic Tutorial

0 comments :

Post a Comment