Reputation: 1495
i just download the cakephp 2.5.1 extract and create a database.
now i am try to using cake bake but terminal showing that error (i am using ubuntu)
Error: Database connection “Mysql” is missing, or could not be created
also no issue with database connection.just tested with pages/index function. its working fine.
should i used empty table ? currently i am using current project database.
database.php
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => 'abcd',
'prefix' => 'lab_',
'encoding' => 'utf8',
);
public $test = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'test_database_name',
'encoding' => 'utf8',
);
}
Sql connect working fine ( find query result ) >
Thanks
update >
Upvotes: 0
Views: 5265
Reputation: 73
Try locating 'mysql.sock' and add the path (eg: /tmp/mysql.sock) of this file to the database config entry 'unix_socket'. so your database config looks like this:
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => '',
'database' => 'abcd',
'prefix' => 'lab_',
'encoding' => 'utf8',
'unix_socket' => '/tmp/mysql.sock',
);
Upvotes: 0
Reputation: 66170
The question is asking which database connection to use - not which database to use i.e.
public $default = array();
^ This one?
public $test = array();
^ Or this one?
Answering abcd
will cause bake to look for and use public $abcd
in the database config class - which evidently is misconfigured.
Upvotes: 1