【问题标题】:Connecting Wordpress on Google Cloud Compute to CloudSQL DB将 Google Cloud Compute 上的 Wordpress 连接到 CloudSQL DB
【发布时间】:2016-07-11 17:47:03
【问题描述】:

我已经尝试并试图让这个工作无济于事。

我在 Google Computer Engine 上运行 WordPress,在 Google CloudSQL 上运行我的数据库。两者都在同一个项目中,我已经设法通过 CloudSQL 代理连接到 MySQL:

./cloud_sql_proxy -dir=/cloudsql -instances=[CLOUDSQL INSTANCE CONNECTION] & mysql -u [CLOUDSQL USER] -S /cloudsql/[CLOUDSQL INSTANCE CONNECTION]

这会调出 mysql 命令,我可以在其中显示远程连接中的数据库。

我不确定是否需要在我的 wp-config.php 文件中添加一些内容以获取 CloudSQL 数据库或其他内容。

我已经设置了允许 CloudSQL 访问的范围,并且我能够实际从 GCE 连接到 CloudSQL 数据库,但我不确定如何让 wordpress 访问数据库。

我在这里看到了这个:Connecting Google Cloud SQL with Wordpress on Google Compute Engine 但这对我没有帮助,因为我不确定到底需要做什么。

如果能提供任何帮助,我将非常感激。

【问题讨论】:

    标签: google-compute-engine google-cloud-sql


    【解决方案1】:

    虽然您使用 Google Compute Engine 而不是 Google App Engine 来托管您的 WordPress,但配置“wp-config.php”应该与https://github.com/GoogleCloudPlatform/appengine-php-wordpress-starter-project/blob/master/wp-config.php 中的代码非常相似,如http://googlecloudplatform.github.io/appengine-php-wordpress-starter-project/ 中所述。您应该将 DB_HOST 设置为“:/cloudsql/[CLOUDSQL INSTANCE CONNECTION]”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-08-15
      • 1970-01-01
      • 1970-01-01
      • 2021-05-28
      • 1970-01-01
      • 2021-11-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多