Connecting to Cloud SQL through deployed App Engine app (Different regions)
<p>I currently have a deployed App Engine application (authorized through Cloud SQL) and in the same project as my Cloud SQL instance. I am using Python &amp; Flask and follow the original Google code to connect to Cloud SQL.</p>

<pre><code>if os.getenv('SERVER_SOFTWARE', '').startswith('Google App Engine/'):
    try:
        return MySQLdb.connect(
             unix_socket='/cloudsql/{}:{}'.format(
                 CLOUDSQL_PROJECT,
                 CLOUDSQL_INSTANCE),
             user='root',
             db='my_db'
             )
    except:
        stacktrace = traceback.format_exc()
        logging.error("%s", stacktrace)
        return False
else:
    try:
        return MySQLdb.connect(host='xxx.xxx.xx.xx', 
                               user='root',
                               db='my_db',
                               passwd='password',
                               port=3306)
    except:
        return False
</code></pre>

<p>When running on the local devserver everything is fine but since deployment I have not been able to connect to Cloud SQL. This is the error I get:</p>

<pre><code>OperationalError: (2013, "Lost connection to MySQL server at 'reading initial communication packet', system error: 38")
</code></pre>

<p>I have checked multiple times that the two variables CLOUDSQL_PROJECT &amp; CLOUDSQL_INSTANCE are configured correctly.
I have also tried connecting without specifying db, with/without specifying password and so on. 
One potential issue could be the fact that our App Engine instance is in us-central(to be changed) and our Cloud SQL is in euro-west. I was wondering if that could be the source of the problem since I do not see anything else that could be causing this error or am I making a mistake somewhere else.</p>

<p>Thank you for your time and advice.<br/>
Alex</p>