我正在运行Kohana v3.2,我只是想用一个小的MVC来启动和运行这个系统。我将遵循本教程:http://kowsercse.com/2011/09/04/kohana-tutorial-beginners/
在我进入添加新文章部分之前,一切似乎都很顺利,我创建了文件,但当我将浏览器指向文章/新控制器/操作时,我得到了这个错误:
Database_Exception [ 2 ]: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Access denied for user 'ODBC'@'localhost' (using password: NO)
MODPATH\database\classes\kohana\database\mysql.php [ 67 ]
62 catch (Exception $e)
63 {
64 // No connection exists
65 $this->_connection = NULL;
66
67 throw new Database_Exception(':error',
68 array(':error' => $e->getMessage()),
69 $e->getCode());
70 }
71
72 // \xFF is a better delimiter, but the PHP driver uses underscore我仍然是PHP的新手,也是Kohana的新手,但是从错误中可以看出,ORM试图使用用户名ODBC访问我的数据库,但到目前为止,我还没有在我创建的页面/文件中定义这个用户名,下面是我的应用程序配置: database.php / config
<?php defined('SYSPATH') or die('No direct script access.');
return array
(
'default' => array
(
'type' => 'mysql',
'connetion' => array
(
'hostname' => '127.0.0.1',
'database' => 'kohana_blog',
'username' => 'root',
'password' => '',
'persistent' => FALSE,
),
'table_prefix' => '',
'charset' => 'UTF8',
'caching' => FALSE,
'profiling' => TRUE,
)
);任何想法都很棒,谢谢你:)
发布于 2012-11-18 19:34:55
我假设您已经安装了ODBC/Connector -它是一个数据库驱动程序,它会将自身(ODBC)创建为默认用户。因为您没有在配置中指定用户(而且您没有指定,因为您有一个拼写错误;),所以默认情况下它会尝试与ODBC连接。
如果您更正了数据库配置文件的第8行,则一切都应该开始正常工作。
...
'type' => 'mysql',
'connection' => array
(
'hostname' => '127.0.0.1',
...哦,除非您的主机文件设置得很奇怪;您应该能够使用localhost而不是127.0.0.1 -这并不是说有什么不同(除了无论您使用的是IPv4还是IPv6,localhost都可以工作的事实),它可能只是更容易读取/键入。
https://stackoverflow.com/questions/10575275
复制相似问题