1

I am new to google cloud but was just able to deploy the test Django app that google provided in their documentation. This process included downloading the cloud_sql_proxy and running the following in the terminal (MacOS):

./cloud_sql_proxy -instances="my-instance-274702:us-central1:fms"=tcp:3306

This command starts running the proxy in order to connect locally to the DB in the cloud. Everything was working fine until I terminated the proxy with ctrl + C. When I ran the following command to start the proxy again I got the following error:

ludovico@Ludovicos-MacBook-Pro django % ./cloud_sql_proxy -instances="my-instance-274702:us-central1:fms"=tcp:3306
2020/04/18 23:38:10 Rlimits for file descriptors set to {&{8500 9223372036854775807}}
2020/04/18 23:38:12 listen tcp 127.0.0.1:3306: bind: address already in use

I got this error the first time I did this but I fixed it by shutting down the MySQL server that was running on port 3306. Now however, port 3306 is already bound to the cloud_sql_proxy and so it is throwing an error and is unable to start the proxy. If I run the same command with port 3307 it works just fine:

./cloud_sql_proxy -instances="my-instance-274702:us-central1:fms"=tcp:3307

But Django does not look for port 3307 it looks for port 3306.

Is it possible to unbind port 3306? Better yet, is there a command to start running the proxy instead of binding and unbinding port 3306 each time?

1 Answers1

3

use ss -lptn the sport command to show which port is bind to which process. Then kill the process running on 3306 by kill -9 {process_id} this will unbind your busy port 3306. Then you can run process on 3306.

Rahul
  • 895
  • 1
  • 13
  • 26