CakePHP数据库连接“Mysql”丢失,或无法创建。 core.php和bootstrap.php

时间:2014-10-16 15:14:51

标签: php mysql cakephp cakephp-2.0

我在发布此问题之前已经找到了答案,似乎问题出现在core.php或bootstrap.php文件中。我已经看到有人说我需要更改前缀或类似内容,但我不明白我应该更改它们到底是什么。有谁可以帮助我吗?这是错误页面:

数据库连接" Mysql"丢失,或无法创建。 错误:发生内部错误。

Stack Trace
CORE/Cake/Model/Datasource/DboSource.php line 260 → Mysql->connect()
CORE/Cake/Model/ConnectionManager.php line 105 → DboSource->__construct(array)
CORE/Cake/Model/Model.php line 3476 → ConnectionManager::getDataSource(string)
CORE/Cake/Model/Model.php line 1126 → Model->setDataSource(string)
CORE/Cake/Model/Model.php line 3498 → Model->setSource(string)
CORE/Cake/Model/Model.php line 1355 → Model->getDataSource()
CORE/Cake/View/Helper/FormHelper.php line 207 → Model->schema()
CORE/Cake/View/Helper/FormHelper.php line 459 → FormHelper->_introspectModel(string, string)
APP/View/Layouts/default.ctp line 85 → FormHelper->create(string, array)
CORE/Cake/View/View.php line 935 → include(string)
CORE/Cake/View/View.php line 897 → View->_evaluate(string, array)
CORE/Cake/View/View.php line 529 → View->_render(string)
CORE/Cake/View/View.php line 474 → View->renderLayout(string, string)
CORE/Cake/Controller/Controller.php line 952 → View->render(string, null)
APP/Controller/PagesController.php line 69 → Controller->render(string)
[internal function] → PagesController->display(string)
CORE/Cake/Controller/Controller.php line 490 → ReflectionMethod->invokeArgs(PagesController, array)
CORE/Cake/Routing/Dispatcher.php line 185 → Controller->invokeAction(CakeRequest)
CORE/Cake/Routing/Dispatcher.php line 160 → Dispatcher->_invoke(PagesController, CakeRequest, CakeResponse)
APP/webroot/index.php line 108 → Dispatcher->dispatch(CakeRequest, CakeResponse)

1 个答案:

答案 0 :(得分:0)

您是否在网站和数据库之间建立了正确的连接?我能想到这个问题的唯一原因。检查你是database.php文件中的配置设置