How to Launch MySQL in Google SQL


Step 1. Open Google Cloud Services & Click Product & Services at the top left most part of the page.

GC instance creation gc main page

Step 2. Now Click on SQL at the Service Panel of page.

sql service panel pic

Step 3. Now on the center of the page there is big blue button Create Instance click on it.

Create instance pic image

Step 4. Choose Instance type as per your requirement,as for now i am choosing First Generation Instance.

Choose instance type image

Step 5. Specify the Name and following details as per your requirement.

Name : Any name of instance according to your requirement
Region : As per your requirement (Your Compute Instance and Sql Instance must be in the same Region)
Preferred location : Compute Engine Zone

Now click on Create

Create instance details pic

Step 6. Now your Instance is created successfully.

sql instance successfully created pic

Step 7. Click on Instance to get complete Details of your Instance.

SQL Instance details pic
SQL Instance details pic 2

How To Connect SQL Instance with Compute Instance

Step 8. Now go to Access Control and configure Authorization settings.

Access conteol auth pic
Click on Add network

Name : Mention the Name of your New Network as per your requirement
Network : Specify the IP Address of your compute Instance

Now Click on done to save your settings.

Auth network pic

Step 9. Now at the Right side of Authorization column there is Another column Users click on it.

user settings pic

Now we have to add New User to Established a connection between Compute Instance and SQL Instance.For this click on Create user account and configure below settings.

User name : root
Password : As per your requirement
Allow any host (%) : yes

Now click on create

Create user setting picuser account created pic

Step 10. Now at the Right side of Users column there is Another column of IP address click on it.

ip address column pic

Now Click on Request IPv4 address,after that you will get new ip address for your SQL Instance.

ip address column pic 1

Step 11. Now move into Compute Engine and Login into your terminal & then fire below command.

# apt-get update
# apt-get install mysql-server mysql-client -y
# mysql – -host=[INSTANCE_IP_ADDR] – -user=root – -password

Host : Ip address of your SQL Instance
User : Sql user
Password : Sql user password

sql instance connectivity picSuccessfully login in mysql pic
Now your are successfully login in your Sql Database.

 Step 12. If you want to test your connectivity then you have to create a database from your instance.  

create database pic

Step 13. Now move in your Mysql Instance and check Database in Databases column.

mysql database employee pic

Note :Once your database is created , you can view the same under the database column in mysql instance.

Comments are closed