Sunday, June 7, 2020

[google-cloud-sql-discuss] Can't connect over mysql-connector-python

I am very new to mysql I always use nosql db options I had a lot of issues and at the end when I am comfortable I want to let go of whole auto backup multi region config stuff to google and start to try cloud sql while everything is ok with private ip connections and such. I can connect from compute instances by mysql -h -u -p command but can't connect with mysql-connector-python 

this is what I used for connection string I am trying to find solutions without putting proxy and a lot of complication between if that's possible.

import mysql.connector
import config as cfg

def connect_db():
    mydb = mysql.connector.connect(
        host=cfg.config["sql"],
        user=cfg.config["user"],
        passwd=cfg.config["password"],
        database=cfg.config["db"],
        connection_timeout=300,
        )
    return mydb

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/c8dc2979-88b7-484b-b466-a15dd17dce95o%40googlegroups.com.

No comments:

Post a Comment