我试图从cake命令行工具生成模型代码.但得到了这个问题.
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's showing that MysqL database is connected at localhost in cakePHP directory)
我正在使用MAMP.
我搜索了很多并找到了一些解决方案.例如,这个
CakePHP: No such file or directory (trying to connect via unix:///var/mysql/mysql.sock)
/Applications/MAMP/tmp/MysqL/MysqL.sock (not present in directory)
但在我做任何事情之前,问题是MysqL.sock文件不存在于此目录中.我试过重新安装MAMP但仍然没有MysqL.sock.
请帮帮我解决这个问题?我可以创建自己的MysqL.sock文件..?
编辑:我的数据库配置
public $default = array( 'datasource' => 'Database/MysqL','persistent' => false,'host' => 'localhost','login' => 'root','password' => 'root','database' => 'db_name','prefix' => '' );