0
votes

In CodeIgniter, I have Database Error:

A PHP Error was encountered

Severity: Warning

Message: mysqli::real_connect():

Filename: mysqli/mysqli_driver.php

Line Number: 161

Unable to connect your database server using provided setting.

FileName:core/CodeIgniter Line:500

I can't understand why this error occured in CodeIgniter

1
What version of codeigniter you are using? And please add your database configuration - Mr. ED

1 Answers

0
votes

navigate to application/config/database.php and update your database connection settings

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'DATABASE USERNAME';
$db['default']['password'] = 'DATABASE PASSWORD';
$db['default']['database'] = 'DATABASE NAME HERE';
$db['default']['dbdriver'] = 'mysql';

Also make sure that the database is running.

Note: CodeIgniter 3 does not work with mysql. The database type. ie: mysqli, postgre, odbc, etc. Must be specified in lower case, as pointed out by @wolfgang1983 in comment below.