title: Connection refused - Connecting to Google Cloud SQL
body: <p>I have a Laravel 5.3 application which I have deployed using Google Application Engine. However, when I query my database, I am faced with the following error:</p>
  
  <pre><code>SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `users` where `email` = test+support@loungeroom.nl limit 1)
  </code></pre>
  
  <p>My <code>app.yaml</code> file contents are as follows:</p>
  
  <pre><code>runtime: php
  env: flex
  
  runtime_config:
    document_root: public
  
  # required on some platforms so ".env" is not skipped
  skip_files: false
  
  env_variables:
    # The values here will override those in ".env". This is useful for
    # production-specific configuration. However, feel free to set these
    # values in ".env" instead if you prefer.
    APP_LOG: errorlog
    STORAGE_DIR: /tmp
    MYSQL_DSN: mysql:unix_socket=/cloudsql/zoho-portal-159018:us-central1:zoho-portal;dbname=zoho_portal
    MYSQL_USER: adeel
    MYSQL_PASSWORD: pass
  
  beta_settings:
      cloud_sql_instances: zoho-portal-159018:us-central1:zoho-portal
  </code></pre>
  
  <p>I have followed all the steps listed in <a href="https://cloud.google.com/appengine/docs/flexible/php/using-cloud-sql#setting_up_your_local_environment" rel="nofollow noreferrer">this</a> tutorial. I have also ensured that my Cloud SQL API is enabled.</p>