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)