当前位置:Gxlcms > PHP教程 > ci框架连接数据库问题

ci框架连接数据库问题

时间:2021-07-01 10:21:17 帮助过:24人阅读

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试试看。

人气教程排行