I'm using Google Cloud SQL 2nd generation and installed cloud-sql-proxy on my local machine.
On my local machine I'd simply connect to 127.0.0.1:3306 and this has been working fine, in NodeJs, Php and using the mysql command line client.
On Google App Engine Managed VM (flexible environment) i'm using unix_socket or socketPath '/cloudsql/MY_PROJECT_ID:us-central1:SQL_INSTANCE' this has been working fine too, in both, Php and NodeJs.
What doesn't work is MySQL Workbench, I can't figure out how to get it to connect. Does it use another protocol or is cloud-sql-proxy for command line only ?
Here is how I start cloud-sql-proxy
this works:
./cloud_sql_proxy \
-instances=MY_PROJECT:us-central1:MY_SQL_INSTANCE=tcp:3306 \
-credential_file='/Users/ME/SomeFolder/MY_SERVICE_ACC_KEY.json'
after that I'd use MySQL Workbench to try to connect to 127.0.0.1:3306, but I always get an error :
SSL connection error: socket layer receive error
local PHP, NodeJS and mysql client work though.
Any help would be appreciated
Ok, I got it working and believe it might be useful for others too:
I couldn't get it working over the tcp connection, but I figured out how to use the socket method running without fuse:
sudo ./cloud_sql_proxy \
-dir=/cloudsql \
-instances=MY_PROJECT:MY_SQL_REGION:MY_SQL_INSTANCE \
-credential_file='/Users/ME/some_folder/MY_SERVICE_ACC_KEY.json'
couple of things here:
/cloudsql has to already exists e.g. sudo mkdir /cloudsqlinstances or it will use a tcp connection instead.In MySQL Workbench:
Database > Manage Connections...Connection > Connection Method choose Standard (TCP/IP)Parameters set Host: localhost Port:3306 (although I don't think it matters)Advanced > Others: enter socket=/cloudsql/MY_PROJECT:MY_SQL_REGION:MY_SQL_INSTANCETest Connection it should as for your username and password, success.This error indicates that MySQL Workbench is requesting an SSL connection, which is not supported via the proxy. The proxy always uses SSL between the local machine and the instance so there's no need to enable SSL at the MySQL protocol level.
Can you try turning off SSL in MySQL Workbench connection settings?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With