I am trying to connect database using codeigniter 3 but i am facing this issue anybody please help.
A PHP Error was encountered Severity: Warning Message: mysqli::real_connect(): (HY000/2005): Unknown MySQL server host 'pd8344-001.privatesql' (2) Filename: mysqli/mysqli_driver.php Line Number: 202 Backtrace: File: /var/www/html/importdb/index.php Line: 292 Function: require_once
And
A Database Error Occurred Unable to connect to your database server using the provided settings. Filename: core/CodeIgniter.php Line Number: 500
here is my db setting in config file.
$db['default'] = array(
'dsn' => '',
'hostname' => 'pd8344-001.privatesql',
'port' => '3306',
'username' => '****',
'password' => '****',
'database' => 'db_name',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => TRUE,
'db_debug' => TRUE,//(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
);
Set the hostname in your database config file to the actual hostname of the database server and it should then work as expected.
A valid hostname is either a domain, or IP. Rather than
pd8344-001.privatesql
I would expect to see something more likepd8344-001.privatesql.com
for example.If you are having trouble finding the hostname and your host provides a phpMyAdmin interface, log into your phpMyAdmin account and copy the current URL with everything after (and including) "/phpMyAdmin" removed.
E.g.
You should get