Skip to content
Advertisement

Live Server MySQL connection time out, on Google Cloud Instances

A PHP Error was encountered Severity: Warning

Message: mysqli::real_connect(): (HY000/2002): Connection timed out

Filename: mysqli/mysqli_driver.php

Line Number: 203

Backtrace:

File: /var/www/html/medical-survey/application/models/Userdata_model.php Line: 8 Function: database

File: /var/www/html/medical-survey/application/controllers/Admins.php Line: 9 Function: model

File: /var/www/html/medical-survey/index.php Line: 315 Function: require_once

and

A Database Error Occurred Unable to connect to your database server using the provided settings.

Filename: core/Loader.php

Line Number: 357

When I attempt to load my page that uses the database, it shows this error

database.php:

JavaScript

I had already tried using ‘hostname’ => ‘localhost’, and it also did not work

Advertisement

Answer

I had solved it, I made a new user and grant them permission to the database. Then use that user and it worked.

‘hostname’ => ‘localhost’,

‘username’ => ‘new_user’,

‘password’ => ‘new_password’

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement