mardi 13 mai 2014

MySQL - connexion Google Cloud SQL avec Wordpress sur Google Compute moteur - Stack Overflow


I've been running a successful Wordpress install on Google Compute Engine with Nginx, Php-fpm and Mysql.


I noticed you can also run Wordpress on App Engine with a Cloud SQL connection as mentioned here https://developers.google.com/appengine/articles/wordpress?hl=en


I want to use Wordpress on Compute Engine with the db running on Cloud SQL.


On AppEngine, you need to put the following lines in the wp-config.php file


if(isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App      Engine') !== false) {
define('DB_HOST', ':/cloudsql/YOUR_PROJECT_ID:wordpress_db_name');F
}else{
define('DB_HOST', 'localhost');
}

Is there a similar way to connect Wordpress on Compute Engine with Cloud SQL?




No. There is no need to connect to fancy socket names, you need to set up Wordpress as a usual MySQL client, just keep in mind that you need to pre-authorize Compute Engine instance to access your Cloud SQL instance.




It doesnt work.


i tried changing


define('DB_HOST', 'localhost'); 

to


define('DB_HOST', 'cloudsql-ip-address');

it did not work.


i get 'Error establishing a database connection'



I've been running a successful Wordpress install on Google Compute Engine with Nginx, Php-fpm and Mysql.


I noticed you can also run Wordpress on App Engine with a Cloud SQL connection as mentioned here https://developers.google.com/appengine/articles/wordpress?hl=en


I want to use Wordpress on Compute Engine with the db running on Cloud SQL.


On AppEngine, you need to put the following lines in the wp-config.php file


if(isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App      Engine') !== false) {
define('DB_HOST', ':/cloudsql/YOUR_PROJECT_ID:wordpress_db_name');F
}else{
define('DB_HOST', 'localhost');
}

Is there a similar way to connect Wordpress on Compute Engine with Cloud SQL?



No. There is no need to connect to fancy socket names, you need to set up Wordpress as a usual MySQL client, just keep in mind that you need to pre-authorize Compute Engine instance to access your Cloud SQL instance.



It doesnt work.


i tried changing


define('DB_HOST', 'localhost'); 

to


define('DB_HOST', 'cloudsql-ip-address');

it did not work.


i get 'Error establishing a database connection'


0 commentaires:

Enregistrer un commentaire