Creating Database

Once our SQL instance is ready, let’s create a Database. Navigate to all instances and then select the database instance you have created and scroll down to find Open Cloud Shell.

Wait for few seconds until the terminal opens up. You will find a pre-written command is there for you to connect your database to the Cloud shell. Press ENTER and give your instance’s password.

After sometime MySQL prompt will open and you can execute MySQL quires.

To learn about MySQL Quires check this article on mysql-common-mysql-queries.

To create a new Database in MySQL execute the following query

CREATE DATABASE guestbook;

This will create a new database named “guestbook” in cloud sql.

Now using the same database create a new table and insert two rows of data. Let’s name our table as “entries” and columns as “guestName”, “content”, and “entryID”. We will make “entryID” as the primary key for the table.

/* Using the guestbook database*/
USE guestbook;

/*Create table */
CREATE TABLE entries (guestName VARCHAR(255), content VARCHAR(255),
entryID INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(entryID));

/*Insert Data*/
INSERT INTO entries (guestName, content) values ("first guest", "I got here!");
INSERT INTO entries (guestName, content) values ("second guest", "Me too!");

Let’s check the table we have just created. Execute the following query to see the table.

SELECT * FROM entries;

As you can see 2 rows are there in the table with the data we have inserted.

How to Use Cloud SQL to Create and Manage Relational Databases

Data is everywhere, and managing data is a challenge. Most web websites and applications, businesses, and organizations use databases to store their data. while everything is moving online in a rapid manner managing databases becomes a challenge for organizations. Google Cloud Platform solves all major Relational database problems by introducing their Cloud SQL. Cloud SQL supports all major RDBMS and provides migration from offline databases. In this article, we will learn how businesses can use Cloud SQL to create databases and manage Relational Databases and use their most of time on business logic rather than investing in managing Databases.

Similar Reads

What is SQL Database?

Relational databases are referred to as SQL databases. SQL is a structured query language used for programming and managing Relational Databases. A relational database is a database where data are stored in the form of tables and tables share a relationship among themselves. In these types of Databases, each row reflects a data entity, and every column defines a specific information field. SQL provides all major operations like create, read, update, and delete for a Relational Database or SQL Database....

What is Cloud SQL?

Cloud SQL is a fully-managed relational database service provided by Google Cloud Platform. Cloud SQL manages your databases so you don’t have to, so your business can run without disruption. From automatic backups to high availability, this service of database management, allowing organizations to focus on business logic while leaving the headache of database administration to Cloud SQL. Cloud SQL supports a variety of popular relational database management systems (RDBMS) including: MySQL, PostgreSQL, SQL Server. Learn more on Cloud SQL by visiting google-cloud-sql....

Benefits of Cloud SQL

Multiple Database Support: Cloud SQL supports multiple database engines, which including MySQL, PostgreSQL, and Microsoft SQL Server. This helps users to choose the best suitable database for them and migrate from the existing database....

Setting Up a SQL Database- Process

Step 1: Create Instance...

Enabling SQL Admin API

SQL Admin API in Google Cloud Platform (GCP) allows you to programmatically manage your Cloud SQL databases using API requests. Cloud SQL provides a REST API for administering your instances programmatically. The SQL Admin API provides a set of methods for tasks such as creating and managing database instances, configuring user accounts, and handling backups....

Creating Database

Once our SQL instance is ready, let’s create a Database. Navigate to all instances and then select the database instance you have created and scroll down to find Open Cloud Shell....

Managing Relational Database using Cloud SQL

Google Cloud platform provides plenty of features to manage relational databases. You can use charts to observe your instance behavior. Create your databases using GUI or using cloud shell. Cloud SQL provides option for replication and high availability. You can always opt for better performance and storage by upgrading your plans and services so that you don’t feel problems operating your database services running on Cloud SQL. If you are migrating from an existing database, use tools like mysqldump or pg_dump to import data into your Cloud SQL instance....

Conclusion

Cloud SQL provides user the priviledge to create and manage Relational Databases effortlessly. Automatic frequent tasks and backup processes Cloud SQL helps reducing down-time and Integration with google services is one of the major feature of Cloud SQL. Through this article we have discussed creation and management of Google Cloud’s Cloud SQL. You can explore more on Google Cloud domain by visiting the article on...

FAQs on Cloud SQL to Create and Manage Relational Databases

Which Relational Database Engines Are Supported By Cloud SQL?...

Contact Us