Greetings all,
First time to post to this forum. So I have a service implemented in Python-Flask which I am currently running in App Engine. I decided to add a short block of mysql code to connect and insert into a mysql database. In this case I know the mysql database and related user account are working as I have the database configured to accept outside request and the user account I have configured to not be bound to specific incoming IP address. This has been fully tested from multiple outside servers and the problem is definately inside App Engine.
The dump from inside Google Cloud log view shows the failure point. This is when the connection is attempted.
File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/third_party/MySQLdb-1.2.5/MySQLdb/connections.py", line 193, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2004, "Can't create TCP/IP socket (-1)")
This led me to do some digging and found another user who had the same problem with no resolve.
Responses from others on that thread indicate that indicate that there is a problem with using TCP/IP sockets and the MySQLdb library inside App Engine. So I'm hoping to get confirmation this is true and curious about best work around approaches. It seems odd the MySQL library would be officially supported in App Engine only to be blocked because TCP IP connections made from MySQLDB calls are not supported.
I am adding MySQL support by including it in my App.yaml using version 1.5.2
At first I was thinking that hosted in App Engine Flask could only communicate with Google SQL (managed MySQL) but In the GCS documentation it states explicitly that MySQL databases hosted outside GCS are supported. Although it shouldn't make a difference, in this case the MySQL database I'm connecting to is hosted in a Compute Engine VM inside the same GCS account where the App Engine instance is running.
Thanks,
Jeremy