I had uploaded my website to server and then I tried to access, but the code igniter returns me that error that I don’t find any answer. Why is this happening?
My config database is set like:
$db['default'] = array( 'dsn' => '', 'hostname' => 'localhost', 'username' => 'netservice', 'password' => '*********', 'database' => 'valedastrutas', 'dbdriver' => 'mysqli', 'dbprefix' => '', 'pconnect' => FALSE, 'db_debug' => FALSE, 'cache_on' => FALSE, 'cachedir' => '', 'char_set' => 'utf8', 'dbcollat' => 'utf8_general_ci', 'swap_pre' => '', 'encrypt' => FALSE, 'compress' => FALSE, 'stricton' => FALSE, 'failover' => array(), 'save_queries' => TRUE, );
Advertisement
Answer
MySQL connection driver does not get any meaningful server at the location of localhost. So use,
'hostname' => '127.0.0.1'
rather than
'hostname' => 'localhost'