I have a GAE app setup and authorized with a Google Cloud SQL instance, but I can't seem to get rid of this error:
OperationalError: (_mysql_exceptions.OperationalError) (2013, "Lost connection to MySQL server at 'reading initial communication packet', system error: 38")
I'm using Python27 with Flask-SQLAlchemy to connect to the db. Here's the database info:
config.py
CLOUDSQL_DB_NAME = 'db-name'
GAE_PROJECT_ID = 'project-id'
CLOUDSQL_INSTANCE_NAME = 'instance-name'
SQLALCHEMY_DATABASE_URI = 'mysql+mysqldb://root@/{db_name}?unix_socket=/cloudsql/{project_id}:{instance_name}'.format(db_name = CLOUDSQL_DB_NAME,
project_id = GAE_PROJECT_ID,
instance_name = CLOUDSQL_INSTANCE_NAME)
app.yaml
libraries:
- name: MySQLdb
version: latest
- name: jinja2
version: 2.6
# [START env_variables]
env_variables:
CLOUDSQL_CONNECTION_NAME: connection-name
CLOUDSQL_USER: root
CLOUDSQL_PASSWORD: password
# [END env_variables]
This is my first app using Flask on GAE, so I'm not sure if I'm missing something here...