作者:脏的孩_963 | 来源:互联网 | 2017-05-14 02:21
thinkphp数据库的问题用thinkphp框架。newModel()的时候会出错。Exception里的信息好像是"Accessdeniedforuserroot@localhost(usingpassword:NO)"但是我已经在config.php里配置好信息了。其中数据库名称为test,表为think
thinkphp数据库的问题
用thinkphp框架。new Model()的时候会出错。
Exception里的信息好像是
"Access denied for user 'root'@'localhost' (using password: NO)"
但是我已经在config.php里配置好信息了。
其中数据库名称为test,表为think_em。
PHP codehttp://www.CodeHighlighter.com/-->
PHP codehttp://www.CodeHighlighter.com/-->'配置值' 'DB_TYPE'=>'mysql', 'DB_HOST'=>'localhost', 'DB_NAME'=>'test', 'DB_USER'=>'root', 'DB_PWD'=>'welcome', 'DB_PORT'=>'3306', 'DB_PREFIX'=>'think_', 'APP_DEBUG'=>true,);?>
------解决方案--------------------1:上面的错误意思是密码不对,检查一下密码和端口。
2:new Model('');改成:$test=M('Em');
------解决方案--------------------删除 Runtime 中的所有内容后重试