問題描述
我在服務(wù)器上運行的 CodeIgniter 應(yīng)用程序中出現(xiàn)以下錯誤.
I am getting Following error in my CodeIgniter application which is live on server.
這是錯誤的輸出:
遇到 PHP 錯誤
嚴重性:警告
消息:mysqli::real_connect():(HY000/1044):用戶訪問被拒絕'xxx'@'localhost' 到數(shù)據(jù)庫 '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 函數(shù):__construct
File: /home/arya123/public_html/application/controllers/Home.php Line: 7 Function: __construct
文件:/home/arya123/public_html/index.php 行:292 功能:需要一次
File: /home/arya123/public_html/index.php Line: 292 Function: require_once
推薦答案
你必須設(shè)置 mysql 端口號,默認為 3306 在database.php 中檢查
you have to set mysql port number which is by default 3306 check this in database.php
使用任何一個
'dbport' => '3306',
或
'hostname' => 'mysql.hostingprovider.com:3306',
這篇關(guān)于嘗試使用 mysqli 連接到數(shù)據(jù)庫時出現(xiàn) Codeigniter 錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!