Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to configure database in CakePHP ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 325
    Comment on it

    Database configuration in cakePHP: Cake PHP configuration file is found in app/Config/database.php

    Example of database configuration file in app/Config/database.php.default.

    class DATABASE_CONFIG {
    
        public $default = array(
            'datasource' => 'Database/Mysql',
            'persistent' => false,
            'host' => 'localhost',
            'login' => 'root',
            'password' => '',
            'database' => 'cakephpdemo',  //Database name
            'prefix' => '',
    
        );
    
        public $test = array(
            'datasource' => 'Database/Mysql',
            'persistent' => false,
            'host' => 'localhost',
            'login' => 'user',
            'password' => 'password',
            'database' => 'test_database_name',
            'prefix' => '',
            //'encoding' => 'utf8',
        );
    }
    

    datasource: Name of the datasource for connection. Examples: Database/Mysql, Database/Sqlserver.

    host: Database server hostname (or IP address).

    login: User name for the account.

    password: Password for the account.

    database: Name of the database for database connection.

    prefix (optional): If database tables dont have prefixes, set this attribute to an empty string.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: