Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 455
chemejoo Avatar asked Feb 08 '18 03:02

chemejoo


1 Answers

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/
like image 193
Anele Avatar answered Oct 05 '22 23:10

Anele