MySql - Google Cloud Platform Database Creation and Connection

Card Puncher Data Processing

About

Article about the connection to a MySQL GCP (Google Cloud Platform) database with:

Steps

Create your database and get your public IP

  • Go to the GCP SQL Console, create your database and save the root password.
  • After the creation, you can see the public IP of the database.

Gcp Sql Gerardnico Public Ip

Add IP authorization

for a private network

For a private network for instance your home …

Whatsmyip

  • Go to the connection tab of the SQL instance and add the following authorization network

Gcp Sql Authorized Network

where the network id is given with the CIDR notation where:

for a public network

For a public network, if you want to authorize any server in case of faas solution or in paas, just add the entire world with the following CIDR 0.0.0.0/0.

Gcp Sql Connection Public Network

Add SSL

The traffic will go through public network, you need therefore to use SSL in order to encrypt the traffic and before all the login/password.

Create a Client Certificate:

Gcp Sql Connection Client Certificate

You got three files:

  • Server Certificate
  • Client Certificate
  • Client Private Key

Put the private key in a secure place.

Connection

Dbeaver

  • With DBeaver, create a MySQL connection and set the following connection properties:
    • public ip of the GCP database in the server host
    • root password that you gave during the database creation

Dbeaver Gcp Mysql Connection

  • Add the SSL parameters

Dbeaver Connection Ssl Gcp

  • Check that you can connect and see the schemas.

Dbeaver Gcp Mysql Schemas Default

MySQL Cli

For a connection with the mysql cli, see MySQL - SSL connection







Share this page:
Follow us:
Task Runner