gpt4 book ai didi

php - 烘焙模型 - CakePHP - Ubuntu

转载 作者:搜寻专家 更新时间:2023-10-31 21:16:39 24 4
gpt4 key购买 nike

我目前正在尝试为 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 生成的启动页面,它会确认我的数据库连接正常。

最佳答案

设法弄清楚:

显然 CakePHP 不太喜欢 localhost 作为主机名。相反,我将其更改为 127.0.0.1

关于php - 烘焙模型 - CakePHP - Ubuntu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7154569/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com