Desired port for google cloudSQL connection is not able to be used
Asked Answered
A

3

7

I am following the steps here, to setup a CloudSQL DB in Google Cloud Platform. I'm stuck at the step with:

./cloud_sql_proxy -instances="[YOUR_INSTANCE_CONNECTION_NAME]"=tcp:3306

I get the message below:

2018/02/07 19:44:10 listen tcp 127.0.0.1:3306: bind: address already in use

I've tried: lsof -i tcp:3306 but nothing shows up. Alternatively, I am able to start a connection to tcp:3307, but that's not what's required in the tutorial, and may prevent the rest of the tutorial from working. When I do lsof -i tcp:3307 however, I am able to see the PID, and kill the SQL connection.

How is the port address 3306 already in use?? Even rebooted my computer.

Amputee answered 8/2, 2018 at 3:56 Comment(1)
That is awkward. I would try using “netstat --listen” to see if it shows a different output. Do you have docker installed? It is possible you are experiencing something like thisLaoag
R
3

My Steps I took to fix

I stop Mysql on my local machine

brew services stop mysql

But I had a problem of giving a directory for

Directory to use for placing Unix sockets representing database instances as seen by the console error

Then I did

sudo mkdir /cloudsql; sudo chmod 777 /cloudsql

My Final Script

./cloud_sql_proxy -instances=MyInstanceConnName=tcp:3306 -projects=myproject -dir=/cloudsql/
Roper answered 23/8, 2018 at 10:5 Comment(0)
K
0

I was running into the same issue, particularly not seeing anything on the specified port. The solution in my particular case was simply to delete the directory that my cloud sql proxies were set up to live in, then create it again. Worked like a charm after that.

Kneecap answered 30/6, 2023 at 16:51 Comment(0)
A
-1

UPDATE: After trying to dig through many methods to kill the sql process, find out whats actually running on it, joining the gcloud slack group to ask around, etc etc, I ended up uninstalling mysql, and reinstalling it. Fixed it. :shrug:

Amputee answered 13/2, 2018 at 22:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.