Skip to main content

Create Cloud SQL Instance on Google Cloud

In this tutorial we will understand how we can create Cloud SQL instance on google cloud.

From the Google Cloud Console menu go to > SQL and click on Create instance

Next chose the MySQL or PostgreSQL option and chose the latest second generation

Next fill the Instance id, root password, select region and zone. click create

It will take some time to create SQL instance, once you see green light just click on instance name and go to overview tab. copy the Public IP address somewhere in Notepad. we need to set this public IP address to SQL instance public IP address so that we can access it from Google Cloud Compute VM.

Next let's create MySQL instance users, we can create databases as well.
I am going to create "mysqluser", just click on Create user account button enter username and password.

Below we can use mysqluser had been created

Now, final step is to set IP address to our SQL instance, for that go to connections tab and find Public IP option, click on add network
Enter name and IP address add /32 for the IP range and click on save button.

Now if you want to connect to Google Compute VM you can use following details :

IP =  "";
DB_USER = "mysqluser";
DB_PASSWORD = "mysqluser"