
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Create a Cloud SQL PostgreSQL instance
/ 25
Create a database on Cloud SQL PostgreSQL instance
/ 25
Create a Cloud SQL MySQL database using the CLI
/ 25
Connect to the MySQL database from a virtual machine
/ 25
In this lab, you use Cloud SQL to create databases that are managed by Google. You create both PostgreSQL and MySQL databases, and you connect to those databases using the Google Cloud CLI and from a virtual machine.
In this lab, you learn how to perform the following tasks:
In this task, you use Qwiklabs and perform initialization steps for your lab.
For each lab, you get a new Google Cloud project and set of resources for a fixed time at no cost.
Sign in to Qwiklabs using an incognito window.
Note the lab's access time (for example, 1:15:00
), and make sure you can finish within that time.
There is no pause feature. You can restart if needed, but you have to start at the beginning.
When ready, click Start lab.
Note your lab credentials (Username and Password). You will use them to sign in to the Google Cloud Console.
Click Open Google Console.
Click Use another account and copy/paste credentials for this lab into the prompts.
If you use other credentials, you'll receive errors or incur charges.
Accept the terms and skip the recovery resource page.
Open a new web browser window and navigate to the Google Cloud Console (console.cloud.google.com). Use the project selector to choose the first project with a leading name of 'qwiklabs-gcp.'
On the Navigation menu (), click SQL.
Click Create Instance and choose the PostgreSQL option.
Under Choose a Cloud SQL edition select Enterprise.
Name the instance ID postgresql-db and enter a password you can remember (or if you prefer, click the Generate button and copy the generated password to a text file).
For Choose region and zonal availability set the region to
Accept the rest of the defaults and click Create Instance.
Click Check my progress to verify the objective.
This opens Cloud Shell at the bottom of the window.
Notice that the connection command is already entered at the prompt.
It will take a little while for Cloud Shell's IP address to be allowlisted by the Cloud SQL network.
When prompted, enter your password.
To see the databases, type the following (a backslash and the lowercase letter L):
Click Check my progress to verify the objective.
It will take a few minutes for the database to be ready.
When the command completes, make note of the database server's primary IP address. Copy and paste this address in a text file, because you will need it later.
Enter the following command to set the password for the root account. Make the password something you can remember.
When prompted, enter your password.
At the mysql prompt, type the following to ensure that it works:
Click Check my progress to verify the objective.
When the command completes, copy the external IP address to the clipboard. You use this IP address to allow this machine to access to the database.
Return to the Console and the Cloud SQL service, and then select the mysql-db database to see its details.
Click Edit from the Overview list at the top of the page.
Open the Connections section, and then click Add Network under Authorized networks. Name the new connection VM and paste the virtual machine's external IP address in the Network text box.
Click Done, and then click Save.
Once the update is complete, return to the Cloud Shell, enter the following command to SSH into the test client:
Click Check my progress to verify the objective.
Congratulations! You used Cloud SQL to create databases that are managed by Google. You created both PostgreSQL and MySQL databases, and you connected to those databases using the Google Cloud CLI and from a virtual machine.
When you have completed your lab, click End Lab. Google Cloud Skills Boost removes the resources you’ve used and cleans the account for you.
You will be given an opportunity to rate the lab experience. Select the applicable number of stars, type a comment, and then click Submit.
The number of stars indicates the following:
You can close the dialog box if you don't want to provide feedback.
For feedback, suggestions, or corrections, please use the Support tab.
Copyright 2022 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one