尝试使用mysqli连接到数据库时出现Codeigniter错误 [英] Codeigniter error when trying to connect to database using mysqli
问题描述
我在服务器上实时存在的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
推荐答案
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屋!