I tried to create model code from cake command line tool. But this is a problem.
Warning Error: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in [/Users/test/Google_WWW/project_name/lib/Cake/Model/Datasource/Database/Mysql.php, line 177] Error: Database connection "Mysql" is missing, or could not be created. (although it showing that mysql database is connected at localhost in cakephp directory)
I am using MAMP.
I searched a lot and found some solutions. For example, this is CakePHP: There is no such file or directory (attempt to connect via unix: ///var/mysql/mysql.sock)
or I can also make a mysql.sock symbolic link.
/Applications/MAMP/tmp/mysql/mysql.sock (not present in directory)
But before you do anything, the problem in the mysql.sock file is not in this directory. I tried reinstalling MAMP, but not mysql.sock.
Please help me solve this problem? Can I create my own mysql.sock .. file?
Edit: My db config
public $default = array( 'datasource' => 'Database/Mysql', 'persistent' => false, 'host' => 'localhost', 'login' => 'root', 'password' => 'root', 'database' => 'db_name', 'prefix' => '' );
Maninreen
source share