Cloud SQL:
==========
|-Cloud SQL
Cloud SQL offers a fully-managed database service for MySQL, PostgreSQL, and SQL
Server, reducing your overall cost of operations and freeing up teams to focus on
innovation
Step-1 Search SQL service
Step-2 Create Instance
Step-3 Choose MYSQL
Step-4 Choose a Cloud SQL edition
-Enterprise
Step-5 Choose a preset for this edition. Presets can be customized later as needed.
-Development
Step-6 Database version
MYSQL 8.0
Step-7 Instance Id
mysql-instance-1
Step-8 Password
2yRk,6DAj<Zvc[B6 (Generate)
Step-9 Choose region and zonal availability
Step-10 Data Protection
Prevent instance deletion(unchecked)
Step-11 Create Instance
Step-12 Open Cloud Shell
Step-13 Check mysql version
mysql --version
Step-14 Go to google and open below website
https://www.ipify.org/
Step-15 Click on Code Sample in given website
Step-16 Run below command in cloud shell
ip=$(curl -s https://api.ipify.org)
echo "My public IP address is: $ip"
e.g:
My public IP address is: 34.126.85.197
Step-17 Copy its public IP address
Step-18 Go back to sql instance
Step-19 Open your sql instance & click on Edit
Step-20 Go to Connections Options
|-Click on Add Network
Name :my-network
Network(IP) :34.126.85.197(public ip of cloud shell)
Step-21 Done & Save
Step-22 Go to SQL Cloud overview option
-Connect to this instance
Connection name buoyant-embassy-465518-j8:us-central1:mysql-
instance-1
Private IP connectivity Disabled
Public IP connectivity Enabled
Public IP address 34.9.180.183
Default TCP database port number 3306
Step-23 Copy from above its public ip address
Step-24 go to cloud shell & write below command to connect with mysql instance.
mysql -h 34.9.180.183 -u root -p
Enter password:2yRk,6DAj<Zvc[B6
mysql>
Step-25 list out all database
show databases;
Step-26 Create new database
create database mydb;
Step-27 Select database
use mydb;
Step-28 list out all tables under mydb(database)
show tables;
Step-29 Create new table
create table user(id int,name varchar(20),age int);
Step-30 Show all records in table
select * from user;
Step-31 Insert data into table
insert into user(id,name,age)values(101,'John',20);
Step-32 Show all records
select * from user;
Step-33 Drop a table
drop table user;
Step-34 Drop a database;
drop database mydb;