首頁 >後端開發 >php教程 >ci框架连接数据库问题

ci框架连接数据库问题

WBOY
WBOY原創
2016-06-06 20:14:282550瀏覽

ci教程里读取新闻的代码运行不了显示错误(database.php已经配置好了)
A PHP Error was encountered

Severity: Warning

Message: mysqli::real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)

Filename: mysqli/mysqli_driver.php

Line Number: 202

Backtrace:

File: D:\PHP\vc14\Apache24\htdocs\ci\application\models\News_model.php
Line: 5
Function: database

File: D:\PHP\vc14\Apache24\htdocs\ci\application\controllers\News.php
Line: 5
Function: model

File: D:\PHP\vc14\Apache24\htdocs\ci\index.php
Line: 292
Function: require_once

A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: core/Loader.php

Line Number: 353

回复内容:

ci教程里读取新闻的代码运行不了显示错误(database.php已经配置好了)
A PHP Error was encountered

Severity: Warning

Message: mysqli::real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)

Filename: mysqli/mysqli_driver.php

Line Number: 202

Backtrace:

File: D:\PHP\vc14\Apache24\htdocs\ci\application\models\News_model.php
Line: 5
Function: database

File: D:\PHP\vc14\Apache24\htdocs\ci\application\controllers\News.php
Line: 5
Function: model

File: D:\PHP\vc14\Apache24\htdocs\ci\index.php
Line: 292
Function: require_once

A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: core/Loader.php

Line Number: 353

密码或者账号错了吧

database.php配置里把localhost换成127.0.0.1试试看。

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn