title: Can't connect to Google SQL in Flask app running locally
body: <p>I'm running <code>Python3</code> in <code>Google App Engine Flexible</code> with <code>gunicorn</code> and <code>Flask</code>. Deploying my app leads to a successful connection, however I can't seem to connect locally and given how slow/tedious it is to push new versions, I'd really like to be able to work from the local version. </p>
  
  <p>Here's the error when I run: <code>gunicorn main:application</code></p>
  
  <pre><code>Traceback (most recent call last):
  File "/Users/XXXX/Desktop/Flexible/pymysql/connections.py", line 
  571, in connect
  sock.connect(self.unix_socket)
  FileNotFoundError: [Errno 2] No such file or directory
  
  During handling of the above exception, another exception occurred:
  
  &lt;stacktrace within pymysql/connection.py&gt;
  
  sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, 
  "Can't connect to MySQL server on 'localhost' ([Errno 2] No such file 
  or directory)") (Background on this error at: 
  http://sqlalche.me/e/e3q8)
  [2019-02-18 09:40:41 +1100] [93536] [INFO] Worker exiting (pid: 93536)
  [2019-02-18 09:40:41 +1100] [93533] [INFO] Shutting down: Master
  [2019-02-18 09:40:41 +1100] [93533] [INFO] Reason: Worker failed to boot.
  </code></pre>
  
  <p>I've set up my Google SQL to have a public IP and I've connected it to my own IP address but this doesn't seem to have changed anything.</p>
  
  <p>This is my code:</p>
  
  <pre><code>engine = create_engine('mysql+pymysql://&lt;USER&gt;:&lt;PASSWORD&gt;@/&lt;DBNAME&gt;?unix_socket=/cloudsql/&lt;INSTANCE_NAME&gt;')
  connection = engine.connect()
  </code></pre>
  
  <p>Any help would be great thanks :) </p>