Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I have tried the following code:

MySQLdb.connect(host='xxx', port=3306, user='yyy')

But I get the following error:

(2005, "Unknown MySQL server host ...

I have tried to remove all firewall restrictions on the external MySQL instance, as a test. I am able to connect to the instance from my developing machine.

I believe this should be possible now that the App Engine supports sockets, or am I wrong?

share|improve this question
    
Did you follow the steps as per this: developers.google.com/cloud-sql/docs/access-control#appaccess. I managed to connect with MySQL Workbench but have not yet tried to connect with GAE hosted app. – Roger Dec 26 '13 at 15:33

I think this connection is not allowed (no external socket support in MySQLdb) : https://developers.google.com/appengine/docs/python/cloud-sql/?hl=en#Python_Using_a_local_MySQL_instance_during_development You have to use localhost/127.0.0.1 or CloudSQL socket (unix_socket='/cloudsql/'):

    if (os.getenv('SERVER_SOFTWARE') and
        os.getenv('SERVER_SOFTWARE').startswith('Google App Engine/')):
        db = MySQLdb.connect(unix_socket='/cloudsql/' + _INSTANCE_NAME, db='guestbook', user='root')
    else:
        db = MySQLdb.connect(host='127.0.0.1', port=3306, user='root')
        # Alternately, connect to a Google Cloud SQL instance using:
        # db = MySQLdb.connect(host='ip-address-of-google-cloud-sql-instance', port=3306, user='root')
share|improve this answer
    
I think that you are right. I have rewritten my application in Java, deployed on GAE, and I am now able to connect to the external MySql instance. – Jacob Dec 29 '13 at 20:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.