尝试使用mysqli连接到数据库时出现Codeigniter错误

Cod*_*ing 2 mysqli codeigniter

我在服务器上实时存在的CodeIgniter应用程序中出现“跟随”错误。

Here is the output of the error:

A PHP Error was encountered

Severity: Warning

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

Filename: mysqli/mysqli_driver.php

Line Number: 161

Backtrace:

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

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

小智 5

您必须设置mysql端口号,默认情况下为3306,在database.php中检查此端口号

使用之一

'dbport' => '3306',
Run Code Online (Sandbox Code Playgroud)

要么

 'hostname' => 'mysql.hostingprovider.com:3306',   
Run Code Online (Sandbox Code Playgroud)