Using the latest CakePHP 2.0 RC3, I am trying to connect to MySQL database. For this, I changed the database.php file present in the app/config directory.
The file contains the below details required for connecting to the database.
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => 'db_world',
'prefix' => ''
);
}
For root, I tried both by setting the password as well as using a blank password.
- Tried using the 'root' user as well as by creating another user with the required privileges.
- Tried giving 127.0.0.1 in place of 'localhost'
- Checked that the database was getting connected using normal php script.
The normal php script to test database connectivity is like:-
<?php
$connect = mysql_connect("127.0.0.1","root","") or die("Could not connect");
mysql_select_db("db_world") or die("Could not find db");
echo "hello world";
?>
The above script works which means that it is not an issue from MySQL side.
Still I always get "Cake is not able to connect to database". Currently I am not sure what I am missing here.
Any pointers to fix the issue will be helpful.