尝试使用mysqli连接到数据库时出现Codeigniter错误 [英] Codeigniter error when trying to connect to database using mysqli

查看:46
本文介绍了尝试使用mysqli连接到数据库时出现Codeigniter错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在服务器上实时存在的CodeIgniter应用程序中遇到跟随"错误.

I am getting Following error in my CodeIgniter application which is live on server.

以下是错误的输出:

遇到PHP错误

A PHP Error was encountered

严重性:警告

消息:mysqli :: real_connect():(HY000/1044):拒绝用户访问 'xxx'@'localhost'到数据库'xxx'

Message: mysqli::real_connect(): (HY000/1044): Access denied for user 'xxx'@'localhost' to database 'xxx'

文件名:mysqli/mysqli_driver.php

Filename: mysqli/mysqli_driver.php

行号:161

回溯:

文件:/home/arya123/public_html/application/controllers/Home.php行: 7功能:__ construct

File: /home/arya123/public_html/application/controllers/Home.php Line: 7 Function: __construct

文件:/home/arya123/public_html/index.php行:292功能: require_once

File: /home/arya123/public_html/index.php Line: 292 Function: require_once

推荐答案

您必须设置mysql端口号,默认情况下为3306

you have to set mysql port number which is by default 3306 check this in database.php

使用

'dbport' => '3306',

 'hostname' => 'mysql.hostingprovider.com:3306',   

这篇关于尝试使用mysqli连接到数据库时出现Codeigniter错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆