Cloud SQL is Managed MySQL on GCP

Robert Thas John
4 min readJul 19, 2018

--

SQL Offerings on Google Cloud Platform

One of the goals of Google Cloud Platform is to help customers migrate their work. This is frequently from either an onsite infrastructure or a shared/co-located infrastructure, to the Google Cloud.

The benefits of such migrations include reduced management and overheads, increased availability, tolerance, and scalability.

Cloud SQL will let you have a relational database in the cloud that is capable of handling gigabytes of data. There are other options that you should consider if you will be handling terabytes and petabytes of data.

Let’s get something out of the way immediately. You could very easily create a compute engine, install MySQL, and call it a day. The question then is, how is Cloud SQL different?

One difference is that you do not need to manage infrastructure yourself. You can even get flexible pricing for those times when you do not need to access the database. This is useful for enterprise applications that are only utilized during work hours.

Secondly, Google manages backups. You also get automatic replication. Let’s not forget the fact that Google also handles your database security.

Assuming I have convinced you of the relevance of Cloud SQL, let’s proceed to setup a Cloud SQL instance.

The first thing you should do is create a storage bucket to store your files for creating the database. These would be your SQL files and any data exports. If you are new to this, check this article.

Proceed to your Cloud console, and go to the SQL section. Click on Create Instance. You should be on the following screen.

Creating a Cloud SQL instance

Click on Choose MySQL, and you will have a screen with three options!

MySQL options on Cloud SQL

Take your pick depending on what you are doing, and proceed to the configuration screen.

MySQL configuration screen
More of the configuration

You get to give the instance a name, and also specify a root password. As is the case with instances, you can choose both the region and the zone. You can choose a database version (5.6 or 5.7 at the time of writing) and configure a machine type and storage. You can choose between a regular HDD and solid-state storage. You can change the size of the storage drive, and this results in higher IOPS.

You can enable auto backups and failover options. You can also authorize IP addresses with your database.

Authorize network

When you are done, go ahead and click on Create. Be patient while the instance gets created. When it’s done, you can click on the instance ID to access it.

SQL Instances

The instance dashboard is impressive.

Cloud SQL Dashboard

If you would like to run any SQL scripts, click on Import on the menu bar. Click on Browse to access your buckets, and locate the file you are interested in.

Import a file

If your scripts creates databases, you can go to the DATABASES tab to see your databases. You can use a similar approach to import data into your tables.

If you would like to access the MySQL, it’s not different from how you would do it normally.

mysql --host=<MySQLIP> --user=root --password

Congratulations, your Cloud SQL is up!

--

--

Robert Thas John
Robert Thas John

No responses yet