在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=zh_CN

我想将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连接起来?

J可危的吉米

不需要。不需要连接到精美的套接字名称,您需要将Wordpress设置为普通的MySQL客户端,只需记住您需要对Compute Engine实例进行预授权才能访问您的Cloud SQL实例。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

在Google Cloud Compute Engine上运行python脚本

使用Go登录到Google Container / Compute Engine中的Google Cloud

使用Oauth连接到Google Compute Engine

如何从Google Container Engine连接Google Cloud SQL?

如何以root用户身份登录Google Cloud Compute Engine?

Google Cloud中的Cloud ML Engine和Compute Engine有什么区别?

无法删除Google Cloud Platform上的Compute Engine实例

在Google Cloud Compute Engine上运行python脚本

尽管有防火墙规则,Google Cloud Compute Engine仍拒绝连接

Google Cloud Compute Engine VM因未知原因停止了?

允许Google Cloud Compute Engine实例将文件写入Google存储桶-Python

Google Cloud Compute Engine上的xgboost超慢

NodeJ:无法从Google App Engine连接Google Cloud SQL

连接到Google Compute Engine实例以运行Python脚本

在Google App Engine中连接到Google Cloud SQL

Google Compute Engine时区

GKE与Google Cloud上的Compute Engine之间的专用连接

在区域之间移动Google Cloud Compute实例

如何查看Google Cloud Compute Engine日志

Google Cloud-Compute Engine,使用实例模板插入实例

连接到Cloud SQL的Google Compute Engine托管的Rails应用中的MySQL服务器已消失

将Google Cloud Compute连接到Google Cloud SQL错误2013(HY000)

在Google Cloud Compute上安装并登录Virtualmin

如何在生产环境中从Google Compute Engine连接到Google Cloud SQL?

利用 Google Cloud Compute Engine V 上的所有 CPU;

无法通过 ssh 连接到 Google Cloud Dataproc 的主节点,但可以通过 ssh 连接到 Compute Engine VM

在 Compute Engine 上安装 Google Cloud SDK:权限被拒绝错误

无法在 Compute Engine 中克隆 Google Cloud Repository

我可以在 Google Cloud Compute Engine 上安装 MySQL 吗?