Message: mysqli::real_connect(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

My website URL is: http://hacettepe-egitim.epizy.com
I got this error while trying to reach my website: “Message: mysqli::real_connect(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.”

I am using codeigniter framework and this is what is in my config.php:
$db[‘default’] = array(
‘dsn’ => ‘’,
‘hostname’ => ‘sql303.epizy.com’,
‘username’ => ‘',
‘password’ => '
’,
‘database’ => ‘********_hacettepe_system’,
‘dbdriver’ => ‘mysqli’,
‘dbprefix’ => ‘’,
‘pconnect’ => FALSE,
‘db_debug’ => (ENVIRONMENT !== ‘production’),
‘cache_on’ => FALSE,
‘cachedir’ => ‘’,
‘char_set’ => ‘utf8mb4’,
‘dbcollat’ => ‘utf8mb4_unicode_ci’,
‘swap_pre’ => ‘’,
‘encrypt’ => FALSE,
‘compress’ => FALSE,
‘stricton’ => FALSE,
‘port’ => ‘3306’,
‘failover’ => array(),
‘save_queries’ => TRUE
);
I dont have quite information about how hosting works but in the previous questions about the same problem, I wrote something like th remote database access is not supported in free accounts. Does this mean that I cannot make any database operations in my php code?

You can but only you can connect with which are in your site account.

You’d use mysqli_connect instead

2 Likes

Thanks for the comment. I tried mysqli_connect but this time “mysqli::connect(): A connection attempt failed because the connected party did not properly respond…” showed up. I am using the db that I created in my account.

You’d enable display errors via alter php config. Cuz the error message doesn’t looks like the php one.
It’ll display the actual connection error

1 Like

This is what is in my config file. After your recommendation I changed log_threshold to 4 which covers all messages. When I look at my log file, I see the same message. Somehow I cant actual connection error. I might have overlooked something.
$config[‘base_url’] = ‘hacettepe-egitim.epizy.com/’;
$config[‘index_page’] = ‘index.php’;
$config[‘uri_protocol’] = ‘REQUEST_URI’;
$config[‘url_suffix’] = ‘’;
$config[‘language’] = ‘english’;
$config[‘charset’] = ‘UTF-8’;
$config[‘enable_hooks’] = FALSE;
$config[‘subclass_prefix’] = ‘MY_’;
$config[‘composer_autoload’] = FALSE;
$config[‘permitted_uri_chars’] = ‘a-z 0-9~%.:_-’;
$config[‘enable_query_strings’] = FALSE;
$config[‘controller_trigger’] = ‘c’;
$config[‘function_trigger’] = ‘m’;
$config[‘directory_trigger’] = ‘d’;
$config[‘allow_get_array’] = TRUE;
$config[‘log_threshold’] = 4;
$config[‘log_path’] = ‘’;
$config[‘log_file_extension’] = ‘’;
$config[‘log_file_permissions’] = 0644;
$config[‘log_date_format’] = ‘Y-m-d H:i:s’;
$config[‘error_views_path’] = ‘’;
$config[‘cache_path’] = ‘’;
$config[‘cache_query_string’] = FALSE;
$config[‘encryption_key’] = ‘’;

$config[‘sess_driver’] = ‘files’;
$config[‘sess_cookie_name’] = ‘ci_session’;
$config[‘sess_expiration’] = 7200;
$config[‘sess_save_path’] = NULL;
$config[‘sess_match_ip’] = FALSE;
$config[‘sess_time_to_update’] = 300;
$config[‘sess_regenerate_destroy’] = FALSE;
$config[‘cookie_prefix’] = ‘’;
$config[‘cookie_domain’] = ‘’;
$config[‘cookie_path’] = ‘/’;
$config[‘cookie_secure’] = FALSE;
$config[‘cookie_httponly’] = FALSE;
$config[‘standardize_newlines’] = FALSE;
$config[‘global_xss_filtering’] = FALSE;
$config[‘csrf_protection’] = FALSE;
$config[‘csrf_token_name’] = ‘csrf_test_name’;
$config[‘csrf_cookie_name’] = ‘csrf_cookie_name’;
$config[‘csrf_expire’] = 7200;
$config[‘csrf_regenerate’] = TRUE;
$config[‘csrf_exclude_uris’] = array();
$config[‘compress_output’] = FALSE;
$config[‘time_reference’] = ‘local’;
$config[‘rewrite_short_tags’] = FALSE;
$config[‘proxy_ips’] = ‘’;

And I realized the codes below works when I execute them in a seperate php file outside the project. I dont know whether this help but.

$mysqli = new mysqli(‘sql303.epizy.com’,‘-----’,‘-------’,‘-------_hacettepe_system’);
if($mysqli->connect_errno){
echo $mysqli->connect_error;

} else{
echo “succesful”;
exit();
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.