Question

I tried to set up WordPress under Google App Engine earlier tonight (following the instructions here: https://developers.google.com/appengine/articles/wordpress).

It runs fine locally, but when I push to remote I get a database error (visible at https://wp-dot-frontiermediag.appspot.com/). If we throw on a /wp_admin/install.php you get:

This either means that the username and password information in your 
wp-config.php file is incorrect or we can't contact the database server 
at :/cloudsql/frontiermediag:fmwp. This could mean your host's database 
server is down.

Here's the relevant code in wp-config:

/** MySQL hostname */
if(isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) {
define('DB_HOST', ':/cloudsql/frontiermediag:fmwp');
}else{
  define('DB_HOST', 'localhost');
}

frontiermediag:fmwp is showing "Status Runnable" in Developers Console > Cloud SQL.

I did this once before and it worked so I'm not sure what I'm missing here. I thought it might have been because I'm using WP 3.8.1. but rolled back to 3.5.1 and same thing's happening.

Any ideas? frontiermediag is listed as an authorized application on the :fmwp ACL.

Was it helpful?

Solution

This situation happened to me earlier.However, I edited my Cloud SQL instance , and set "Preferred Location" as "Follow App Engine App" from Google Developers Console. This database connection problem was solved in my case.

OTHER TIPS

I tried the instructions with wordpress 3.5.1 and the instructions seem to work for me. The code snippet you have above seems right and I am not sure what could be wrong without looking at rest of your code. Can you try the instructions from the beginning one more time with 3.5.1?

I had this issue, because "Follow App Engine App" doesn't seem to be an option for second generation instances in my case, and so the instance connection name includes the region setting.

Look at the instance details, and under properties, find "Instance connection name". That is the text that should follow :cloudsql/.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top