Tag: google cloud sql

  • Google Cloud SQL

    To create a Google Cloud SQL database, run

    gcloud sql instances create INSTANCE_NAME_HERE --activation-policy=ALWAYS --tier=db-n1-standard-1
    

    INSTANCE_NAME_HERE = this can be anything, lowercase letters, 0-9, for identification purpose only.

    db-n1-standard-1 => this is size of the server, you can change it as needed.

    To create a Database, run

    gcloud sql databases create DB_NAME_HERE --instance INSTANCE_NAME_HERE
    

    To create a User, run

    gcloud sql users set-password root --host=%  --instance INSTANCE_NAME_HERE  --password=PASSWORD_HERE
    

    To list all google cloud SQL instances, run

    gcloud sql instances list
    

    Google Cloud SQL

    To list all databases in a Google Cloud SQL server, run

    gcloud sql  databases list --instance INSTANCE_NAME_HERE
    

    list databases in google cloud sql

    To connect to Google Cloud SQL database, run

    gcloud sql connect INSTANCE_NAME_HERE
    

    This will open firewall rule and add your IP so you can connect to Google Cloud SQL server.