sql-servergoogle-cloud-platformportgoogle-cloud-proxy

Checking Cloud SQL Server port?


I have provisioned 2 SQL Servers (DEV & QA) in GCP (in same project and same network) using terraform. I can access the Dev using cloud proxy on 1433 port but I can't access the QA server. How to check the port for QA?

Please guide, I tried but I can't find the way to know the port.

I want to connect to QA db server - I can't pass default port 1433 as it is linked with DEV server, I need to know which port QA db server is running because while provisioning using terraform I have not passed any port. Once port will be know, I can added that port in firewall.


Solution

  • Port 1433 is the localhost port that sql proxy will proxy via. It has nothing to do with the port of the cloud sql database. You do not need to know the port of the database service on the remote machine, sql proxy takes care of that.

    Presumably you tried to connect to both databases at the same time locally and the second connection failed because port 1433 was already in use by your first connection. Just use any other available port on your computer instead.

    This is explained quite clearly in the proxy docs: https://cloud.google.com/sql/docs/sqlserver/connect-auth-proxy