Step 1. Open Google Cloud Services & Click Product & Services at the top left most part of the page.
Step 2. Now Click on SQL at the Service Panel of page.
Step 3. Now on the center of the page there is big blue button Create Instance click on it.
Step 4. Choose Instance type as per your requirement,as for now i am choosing First Generation Instance.
Step 5. Specify the Name and following details as per 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
Step 6. Now your Instance is created successfully.
Step 7. Click on Instance to get complete Details of your Instance.
How To Connect SQL Instance with Compute Instance
Step 8. Now go to Access Control and configure Authorization settings.
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.
Step 9. Now at the Right side of Authorization column there is Another column Users click on it.
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.
Password : As per your requirement
Allow any host (%) : yes
Now click on create
Step 10. Now at the Right side of Users column there is Another column of IP address click on it.
Now Click on Request IPv4 address,after that you will get new ip address for your SQL Instance.
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
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.
Step 13. Now move in your Mysql Instance and check Database in Databases column.
Note :Once your database is created , you can view the same under the database column in mysql instance.
Comments are closed