Google’s Cloud SQL is a fully managed database as a service platform.
First create a SQL instance at
https://console.cloud.google.com/sql/instances
I recommend using the minimal settings to minimize cost
- MySQL
- Single Zone
- Shared Core as machine type
- HDD as storage
- 10G to start with
- Enable public IP however…
- no backup
Click “Create Instance”, and this will take minutes to create the instance. 10 mins + for me.
Go to https://console.cloud.google.com/sql/instances/test-instance/users to create a user to access the database (if you want a user other than root)
(Optional) Go to “Connections” to add 0.0.0.0/0 as authorized network to allow connection from any network.
Install mysql client locally, you should have “mysql” as a command (on mac “brew install mysql”.
Find the IP address from the overview page
mysql --host=35.239.188.111 --user=myuser --password
If you manage to get connected,
show databases;
Then you can proceed to do your regular MySQL like choosing a database, creating tables, inserting rows and performing queries. This covers the basics.
More advance usage include enabling encryptions, restricting authorized network, using cloud sql proxy, running clients from various sources etc. Feel free to explore more.