Unable to connect to the database
Posted by:
Jones NDI
Date: June 09, 2016 08:31AM
Hello everyone,
My website won't show on live server because it can't connect to the database. Here is the database configuration:
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'user_root',
'password' => '*****',
'database' => 'mydatabase_name',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
The error messages? Here they are:
1. A PHP Error was encountered
Severity: Warning
Message: mysqli::real_connect(): (HY000/2002): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Filename: mysqli/mysqli_driver.php
Line Number: 135
Backtrace:
File: /usr/local/pem/vhosts/109098/webspace/httpdocs/mydomain.com/sthes/application/controllers/Home.php
Line: 20
Function: __construct
File: /usr/local/pem/vhosts/109098/webspace/httpdocs/mydomain.com/index.php
Line: 294
Function: require_once
2. A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /usr/local/pem/vhosts/109098/webspace/httpdocs/mydomain.com/sthes/system/core/Exceptions.php:272)
Filename: core/Common.php
Line Number: 564
Backtrace:
File: /usr/local/pem/vhosts/109098/webspace/httpdocs/mydomain.com/sthes/application/controllers/Home.php
Line: 20
Function: __construct
File: /usr/local/pem/vhosts/109098/webspace/httpdocs/mydomain.com/index.php
Line: 294
Function: require_once
3. A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: controllers/Home.php
Line Number: 20