数据库
首页 > 数据库> > mysql-在Google Compute Engine上将Google Cloud SQL与WordPress连接

mysql-在Google Compute Engine上将Google Cloud SQL与WordPress连接

作者:互联网

我已经使用Nginx,Php-fpm和Mysql在Google Compute Engine上成功安装了Wordpress.

我注意到您也可以使用此处提到的Cloud SQL连接在App Engine上运行Wordpress https://developers.google.com/appengine/articles/wordpress?hl=en

我想在Compute Engine上使用Wordpress,并在Cloud SQL上运行数据库.

在AppEngine上,您需要在wp-config.php文件中添加以下行

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');
}

是否有类似的方法将Compute Engine上的Wordpress与Cloud SQL连接?

解决方法:

不需要.不需要连接到精美的套接字名称,您需要将Wordpress设置为usual MySQL client,只需记住您需要pre-authorize Compute Engine实例才能访问您的Cloud SQL实例.

标签:google-cloud-sql,mysql,wordpress,google-compute-engine
来源: https://codeday.me/bug/20191012/1897940.html