我目前正在尝试为 CakePHP 中的一个项目烘焙模型。我已经设置了我的数据库表并烘焙了我的骨架项目。然后我通过终端执行以下命令:
cake bake -app /home/gary/glecto/
然后向我显示正确的菜单。当我选择“M”时,出现以下错误
PHP Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 540
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 540
PHP Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 546
Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 546
PHP Warning: mysql_get_server_info() expects parameter 1 to be resource, boolean given in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 554
Warning: mysql_get_server_info() expects parameter 1 to be resource, boolean given in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 554
PHP Warning: mysql_query() expects parameter 2 to be resource, boolean given in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 588
Warning: mysql_query() expects parameter 2 to be resource, boolean given in /usr/share/php/cake/libs/model/datasources/dbo/dbo_mysql.php on line 588
Your database does not have any tables.
有人对我如何解决这个问题有任何想法吗?我已经挠头好几个小时了。
编辑
连接代码
class DATABASE_CONFIG {
var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'port' => 3306,
'login' => 'root',
'password' => '',
'database' => 'glectoMVC',
);
}
另外 - 如果我查看 cakePHP 生成的启动页面,它确认我的数据库连接正常。