如何将用户添加到Google云端平台上的MySQL实例

问题描述:

我试图遵循Quick Start WordPress for Google App Engine指南,但在尝试本地运行Wordpress时遇到了“创建数据库时出错”(请参阅​​下文)。如何将用户添加到Google云端平台上的MySQL实例

enter image description here

我有一些麻烦,下面的指令:

创建Cloud SQL执行

“后,转到您的实例的访问控制部分,然后点击用户 。点击新用户并创建一个名为root的用户并指定一个密码。现在,您可以使用第三方工具连接到您的Cloud SQL实例,我们将在稍后进行操作。“

当我去实例详细为我创造,我没有看到任何新用户按钮的实例,但只有一个按钮来更改root密码(见下文)。

enter image description here

我只是为root用户更改密码。这是否符合说明?

此外,我将如何相应修改wp-config.php?我现在有以下几点:

// ** MySQL settings - You can get this info from your web host ** // 

if (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) { 
    /** The name of the Cloud SQL database for WordPress */ 
    define('DB_NAME', 'wordpress_db'); 
    /** Live environment Cloud SQL login and SITE_URL info */ 
    /** Note that from App Engine, the password is not required, so leave it blank here */ 
    define('DB_HOST', ':/cloudsql/wordpress-143922:wordpress'); 
    define('DB_USER', 'root'); 
    define('DB_PASSWORD', ''); 
} else { 
    /** The name of the local database for WordPress */ 
    define('DB_NAME', 'wordpress_db'); 
    /** Local environment MySQL login info */ 
    define('DB_HOST', '127.0.0.1'); 
    define('DB_USER', 'root'); 
    define('DB_PASSWORD', 'password'); 
} 

其中'password'被我用来设置MySQL的本地管理员密码取代。由于我在App Engine上指定了密码,因此我是否也应该将其填入第一个DB_PASSWORD字段?

确保您正在编辑wordpress目录中的wp-config.php文件。该演示附带wordpress目录之外的另一个(样本)版本,这会导致混淆。

此外,您需要位于DB_HOST部分的服务器位置。例如,如果在美中区:

if (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) { 
     /** The name of the local database for WordPress */ 
     define('DB_NAME', 'wordpress_db'); 
     /** Live environment Cloud SQL login and SITE_URL info */ 
     /** Note that from App Engine, the password is not required, so leave it blank here */ 
     define('DB_HOST', ':/cloudsql/wordpress-143922:us-central1:wordpress'); 
     define('DB_USER', 'root'); 
     define('DB_PASSWORD', 'password&%^&'); 
    } else { 
     /** The name of the local database for WordPress */ 
     define('DB_NAME', 'wordpress_db'); 
     /** Local environment MySQL login info */ 
     define('DB_HOST', '127.0.0.1'); 
     define('DB_USER', 'root'); 
     define('DB_PASSWORD', 'password&%^&'); 
    } 
+0

[GAEfan](http://*.com/users/3524613/gaefan),谢谢你的回答。从Github存储库中克隆,'wordpress'目录是空的;我应该下载wordpress,将内容放在'wordpress'目录下,并且用'startup'项目附带的(适当修改的)替换'wordpress'中的'wp-config.php'?或者我可以简单地在'wordpress'中只放置'wp-config.php',而没有其他的东西? **编辑**我看到你也回答了我的其他问题:)'wordpress'目录应该充满文件,我应该再次尝试下载。 –