php-docs-samples: Error establishing a database connection

I got all the way through deployment and hit:

Error establishing a database connection

when I tried to load the site. I’d guess a password issue, though it looks OK in wp-config.php.

I don’t see anything in the cloud console logs to help. Is there some extra step to allow the app engine standard app to connect to Cloud SQL? On https://cloud.google.com/appengine/docs/standard/php/cloud-sql/ I see

Add the Cloud SQL instance connection name, database, user, and password to the
 nvironment variables in app.yaml.
appengine/standard/cloudsql/app.yaml VIEW ON GITHUB
env_variables:
  # Replace project, instance, database, user and password with the values obtained
  # when configuring your Cloud SQL instance.
  MYSQL_DSN: mysql:unix_socket=/cloudsql/INSTANCE_CONNECTION_NAME;dbname=DATABASE
  MYSQL_USER: root
  MYSQL_PASSWORD: ''

and the generated app.yaml doesn’t seem to have that section.

Nope, adding that doesn’t seem to have fixed it. 😦

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

@jgacuca567 and @tmatsuo I finally (HOPEFULLY) seem to have got it working permanently. I had to create a new database in MAMP’s PHPMyAdmin and that seemed to fix it.

@jgacuca567 that worked, thank you!! I had to configure MAMP and a few other things but eventually got it to work. Thanks again for all your help!

@bld2104 Sounds good, however make sure you have the database backed up, so it is easier to restore. You can always update manually by running

See Link Below https://cloud.google.com/php/tutorials/wordpress-app-engine-flexible#updating_wordpress_plugins_and_themes.

If it fails lets go from there and start debugging.