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 -
- Is the password of your database entered in the config correct? ('sal123')?
- 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'].
- If none of these work, check your error.log (apache error log) file for more clues.
Related Topics
Where Do We Use the Object Operator "-≫" in PHP
How to Parse a CSV File Using PHP
How to Benchmark Efficiency of PHP Script
How to Remove File Extension from a Website Address
Remove All Attributes from HTML Tags
Detect Language from String in PHP
MySQL Prepared Statements With a Variable Size Variable List
Sum Values of Multidimensional Array by Key Without Loop
MySQLi Bind_Param() Expected to Be a Reference, Value Given
Having Issue With Matching Rows in the Database Using Pdo
Setting Up a Deployment/Build/Ci Cycle For PHP Projects
Is There a PHP Function Like Python'S Zip
Truncate a Multibyte String to N Chars
PHP Sort Array by Subarray Value
Explode PHP String by New Line