简体   繁体   中英

Error establishing a database connection to Cloud SQL

please forgive a novice question:

I have Wordpress up and running on my development server with no problems. When I try to upload it using appengine, I get the following error output from WP_DEBUG, where MYSITEID is the name of my site:

Warning: mysqli_connect(): (HY000/2002): Unable to find the socket transport "tcp" -
did you forget to enable it when you configured PHP? in 
/base/data/home/apps/s~MYSITEID/wp.370505361471441320/wordpress/wp-content/db.php on line 176

It goes on:

"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/MYSITEID:wordpress . This could mean your host's database server is down."

My Cloud SQL instance is up and running and I followed the tutorial steps 7 and 8 exactly.

My wp_config db_host section reads:

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

From the looks of it my error text is almost verbatim what a phpmyadmin user encountered, but I'm still not sure how to resolve it. Do I need to change something on the DB_HOST line? See phpMyAdmin on GAE - Authentication

Thanks for any help - really appreciate that GAE for PHP exists!

Turns out the issue was in db.php - which I had installed in wp-content per the instructions here: http://wordpress.org/plugins/mysqli/installation/

I'm not sure why I originally installed mysqli instead of using mysql; it seemed to fix an earlier php error I was having on my development server. But after removing db.php both my dev version and the Cloud SQL instance work just fine!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM