Getting started with Cloud SQL for SQL Server
![cloudsql](https://www.pythian.com/hs-fs/hubfs/Imported_Blog_Media/cloudsql.png?width=150&height=150&name=cloudsql.png)
Log on to the GCP console
First go to the GCP console and log in using your Google account.Selecting a GCP project
You need to select a project. If you don’t have any projects then go to the project selector page to create one. For this demonstration, I have created and used a specific project namedSandbox
.
![cloudsql01](https://www.pythian.com/hubfs/Imported_Blog_Media/cloudsql01.jpg)
![cloudsql02](https://www.pythian.com/hubfs/Imported_Blog_Media/cloudsql02.jpg)
Cloud SQL
Go to the Cloud SQL page. You can do this by typingcloud sql
in the resources and products search field and select SQL.
![cloudsql03](https://www.pythian.com/hubfs/Imported_Blog_Media/cloudsql03.jpg)
![cloudsql04](https://www.pythian.com/hubfs/Imported_Blog_Media/cloudsql04.jpg)
![cloudsql05](https://www.pythian.com/hubfs/Imported_Blog_Media/cloudsql05.jpg)
Create a SQL Server instance
You are now ready to start configuring your managed instance of SQL Server. For demonstration purposes, I have included my config. information. Please make sure to provide/replace with your own information to set up your own instance.- Provide a name for your instance. For my Instance ID I chose
cloudsql-sqlserver-02
- Provide a strong password for your default service admin username. Remember the default user name is
sqlserver
- Choose Region and Zone. For my Instance I chose region:
northamerica-northeast1
and zone:northamerica-northeast1a
![cloudsql06](https://www.pythian.com/hubfs/Imported_Blog_Media/cloudsql06.jpg)
- Machine type and storage: This is where you would choose which database version and edition you would need. Machine type, compute needs and storage capacity. Accept default and select Close.
![cloudsql07](https://www.pythian.com/hubfs/Imported_Blog_Media/cloudsql07.jpg)
- Connectivity: This is where you would choose how to connect to your database instance. For now, I will use Public IP and will create a Cloud SQL Proxy later on to enable us to connect. Accept defaults and select Close.
![cloudsql08](https://www.pythian.com/hubfs/Imported_Blog_Media/cloudsql08.jpg)
- Auto backups and high availability: This is where you decide if you want to enable ‘Automate backups’, and if you wish to have High Availability (regional) coverage for your instance.
- Flags and parameters: Where you would choose and include Cloud SQL flag and parameters for your database server.
- Maintenance schedule: Maintenance window and timing selection
- Labels
![cloudsql09](https://www.pythian.com/hubfs/Imported_Blog_Media/cloudsql09.jpg)
![cloudsql10](https://www.pythian.com/hubfs/Imported_Blog_Media/cloudsql10.jpg)
![cloudsql11](https://www.pythian.com/hubfs/Imported_Blog_Media/cloudsql11.jpg)
Cloud SQL Proxy
The next step is for you to install the Cloud SQL Proxy. The Cloud SQL Proxy provides secure access to your Cloud SQL Second Generation instances without having to whitelist IP addresses or configure SSL. It's important to follow the steps outlined in the page Quickstart for using the proxy for local testing which shows you how to install and connect to Cloud SQL from a local test environment using the Cloud SQL Proxy. Connecting through the proxy enables you to test an App Engine application in your local environment, or establish a secure connection for database administration. Steps you will need to perform:- Enable the Cloud SQL API.
- Install and authenticate the gcloud command-line tool.
- Install the Cloud SQL Proxy client on your local machine.
- Get the instance connection name (information copied earlier).
- Optional - Connect to your database using the sqlcmd client Connect to your instance (skip this step and use the following section Connecting to your SQL Server instance to connect).
Connecting to your SQL Server instance
As outlined in the previous section, you can connect with sqlcmd, but you can also use other tools. Depending on which OS platform you are using, the following is a list of tools you can download and use to connect to your instance.- sqlcmd: Windows or Linux/macOS
- mssql-cli command line query tool for SQL Server
- SQL Server Management Studio (SSMS)
- Azure Data Studio
<INSTANCE_CONNECTION_NAME>
with your
Instance connection name copied earlier, located on the Instance details page.
./cloud_sql_proxy -instances=<INSTANCE_CONNECTION_NAME>=tcp:1433
![cloudsql12](https://www.pythian.com/hubfs/Imported_Blog_Media/cloudsql12.jpg)
mssql-cli -S 127.0.0.1 -U sqlserver
![cloudsql13](https://www.pythian.com/hubfs/Imported_Blog_Media/cloudsql13.jpg)
![cloudsql14](https://www.pythian.com/hubfs/Imported_Blog_Media/cloudsql14.jpg)
![cloudsql15](https://www.pythian.com/hubfs/Imported_Blog_Media/cloudsql15.jpg)
Share this
Previous story
← How to Quickly Ignore ORA Error on Agent Layer
Next story
How to Read Oracle Traces from SQL*Plus →
You May Also Like
These Related Stories
How to Setup a Google Cloud SQL Replica from an External MySQL Primary
![](https://www.pythian.com/hubfs/How%20to%20Setup%20a%20Google%20Cloud%20SQL%20Replica%20from%20an%20External%20MySQL%20Primary.jpeg)
How to Setup a Google Cloud SQL Replica from an External MySQL Primary
Oct 26, 2023
5
min read
Microsoft SQL Server on Linux – installation (Ubuntu)
Microsoft SQL Server on Linux – installation (Ubuntu)
Jan 16, 2018
5
min read
SQL Injection with MySQL SLEEP()
SQL Injection with MySQL SLEEP()
Mar 2, 2016
4
min read
No Comments Yet
Let us know what you think