我目前正在尝试为CakePHP中的项目烘焙模型。我建立了我的数据库表并烘焙了我的骨架项目。我然后通过终端执行以下命令:烘焙模型 - CakePHP - Ubuntu
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的生成启动页面也证实了我的数据库连接正常。
你可以在app/config/database.php中发布数据库连接信息吗? – Joseph
是你的mySQL服务器在运行吗? –
我与database.php中连接信息编辑,我运行LAMPP – GaryDevenay