Getting Started with Cloud SQL for MySQL
Articles,  Blog

Getting Started with Cloud SQL for MySQL


AASTHA BHARDWAJ: Welcome. My name is Aastha, and I’m an
engineer on the Cloud SQL team. In this video, I’ll show you
how to create, run, and manage SQL instances using
Google Cloud SQL. Cloud SQL helps manage
mundane administrative tasks for MySQL and Postgres
databases so you can focus on what matters. Let’s walk through how to create
a MySQL database on Cloud SQL and connect to it from
the Google Cloud shell. You can set up an instance
in just a few steps. Let’s go through
the basics, and I’ll point out some options for
additional configuration along the way. We’ll start by navigating to
Cloud SQL in the GCP console and clicking Create Instance. And then next, choose a second
generation MySQL database engine. Second generation instances
provide better performance and improve management
tools, like automatic storage increase. I’ll name the instance
and then set the password for our default account. This instance will
be created in the US, and we’ll leave
the zone set to Any so Cloud SQL can choose for us. Let’s take a look at
configuration options. You can specify MySQL
version, instant size, high availability, and more. For this demo, I’ll
choose a four core, high-memory instance. Maximizing memory is a
good choice for MySQL because it can take
advantage of the extra memory for performance. That said, don’t worry too
much about initial sizing. You can scale the
instance up or down later. Let’s increase the storage
capacity to 200 gigabytes, because increasing disk capacity
also increases performance. Check out the performance
calculator below. As I add capacity,
my disk performance increases, which will
allow my database to process more
operations per second. And I’ll enable
Automatic Storage Increase so that I
don’t accidentally run out of disk space. Lastly, let’s ensure that the
database will automatically provide isolation from failures. We can do that by enabling
the high availability configuration, which, for
MySQL, adds a failover replica in another zone. Now that we’re happy with the
configuration of our instance, let’s kick off the creation. It may take a few minutes
for your instance to create. This is a great time to
grab a quick cup of coffee. You can also check the
status of your instance by navigating to
your Instance List. Once you see a green check
mark, your instance is ready. Looks like our instance
has finished creating. Let’s open the Details
page to continue. There are many ways to
connect to this instance. Within GCP, for example, we
could use App Engine, Compute Engine, or Container Engine. But we could also connect
from just about anywhere by authorizing IP addresses
or using the Cloud SQL proxy. For this demo, I’ll connect
using the Google Cloud Shell. Cloud Shell provides
command line access to all of your Cloud resources,
such as Cloud SQL instances directly from the browser. To open the Cloud Shell, click
Connect Using Cloud Shell. As you can see, the
relevant Gcloud command to connect to your
Cloud SQL instance has been pre-typed for us. So all we have to
do is press Enter. And then, enter our root
password from before. And now, we’re connected. So let’s create and
insert some data. To begin, I’ll
create a database. Next, I’ll insert some data. Finally, I’ll make sure the
data is now in our database. And it is. Great. So to recap, in the
last few minutes, we just created a
Cloud SQL instance with high performance
and high availability, and connected to it
with Cloud Shell. Now that you’ve seen how to
get started, give it a try. You can learn more about Google
Cloud SQL in our free trial program here. Thank you for watching.

15 Comments

  • Dan Krueger

    same comment as others…. its not very useful to show us that we can connect with cloud shell… its the google cloud proxy and ssl connections that are confusing…. here’s an idea…. why dont you make another video showing us how to hand type and verify a million different records… hmmm… this is a cool idea but i think you missed the connection with potential users.

  • Chirantan Banerjee

    Connecting to Cloud sql from Compute Engine instance and cloud shell is pretty simple and straight forward. But suppose, you have web application hosted on a Compute engine instance and you need a backend Cloud sql db support to store the web app data. How do I connect the web app to cloud sql in order to insert the values in the particular db in this case. Please put up a useful tutorial.

  • rick segal

    With all respect to the other comments, this five minute video does an excellent first/fast look and getting a db up and running. In five minutes. Aastha, thanks for this video. It was a pretty good return on my five minute investment of time.

  • Emelyne Nawawi

    But how do you view your data in the tables of the database? Like phpmyadmin? I'm at a dead end guys. Please make a tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *