Codeigniter: How to Connect to Your Database Server Using the Provided Settings Error Message

CodeIgniter: Unable to connect to your database server using the provided settings Error Message

For me the issue was in the php.ini file. The property mysql.default_socket was pointing to file in a non-existent directory. The property was pointing to /var/mysql/mysql.sock but in OSX, the file was located in /tmp/mysql.sock.

Once I updated the entry in php.ini and restarted the webserver, the issue was resolved.

CodeIgniter error Unable to connect to your database server using the provided settings.

$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'testdatabase',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);

Try this config.

code igniter error: Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346

The problem is really due to credentials.
I test it using simple code to check if connection can be made.

The problem is in username, i realize there's additional suffix when using hosting. such as suffix_user
I think the same errors in Core/Loader.php Line Number: 346 has the same solution. make sure the username, password and host are right.

It's solved. Thank you everyone for helping.

Codeigniter: A Database Error Occurred Unable to connect to your database server using the provided settings

Check the following -

  1. Is the password of your database entered in the config correct? ('sal123')?
  2. Does the database named - 'splendrz ' exist in your local mysql instance? Also, there seems to be a trailing space in this name. Most likely you need to remove that. ['splendrz'].
  3. If none of these work, check your error.log (apache error log) file for more clues.


Related Topics



Leave a reply



Submit