uksarkar
3 days ago

How to connect to Google Cloud MySql to extranal hosted Laravel project

Posted 3 days ago by uksarkar

I have working project hosted with a PHP server. I want to connect my project with Google Cloud MySQL instance. I have a instance and I add MySQL database and user to it, now I edit my .env file with the following content

DB_CONNECTION=mysql
DB_HOST= GCP instance IP address
DB_PORT=3306
DB_DATABASE= database name
DB_USERNAME= user name 
DB_PASSWORD= the password

Now I am getting error like this

SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'GCP instance IP address' (111 "Connection refused")

Please sign in or create an account to participate in this conversation.