[英]How to add a user to a MySQL instance on the Google Cloud Platform
I'm trying to follow the Quick Start WordPress for Google App Engine guide, but ran into an "Error establishing a database" when trying to run Wordpress locally (see below). 我正在尝试遵循Google App Engine的WordPress快速入门指南,但是尝试在本地运行Wordpress时遇到“建立数据库错误”的问题(请参见下文)。
I'm having some trouble with the following instruction: 我在执行以下说明时遇到了一些麻烦:
"After your Cloud SQL instance is created, go to the Access Control section of your instance and click on Users . Click New User and create a user with the name root and specify a password. Now you can connect to your Cloud SQL instance using 3rd-party tools, which we'll do later." “创建Cloud SQL实例后,转到实例的访问控制部分,然后单击“ 用户” 。单击“ 新用户”并创建一个名为root的用户并指定密码。现在,您可以使用第3个连接到Cloud SQL实例方工具,我们将在以后进行。”
When I go to the Instance details for the instance I created, I don't see any New User button, but only a button to change the root password (see below). 当我转到所创建实例的“ 实例详细信息 ”时,看不到任何“ 新用户”按钮,只有一个用于更改根密码的按钮(请参见下文)。
I simply changed the password for the root user. 我只是更改了root用户的密码。 Is this in accordance with the instructions?
这符合指示吗?
Further, how would I modify wp-config.php
accordingly? 此外,我将如何相应地修改
wp-config.php
? I now have the following: 我现在有以下内容:
// ** 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');
}
where 'password'
is replaced by the password I used to set up MySQL locally. 其中
'password'
被我用来在本地设置MySQL的密码代替。 Since I've specified a password on the App Engine, should I also not fill it into the first DB_PASSWORD
field? 由于我已经在App Engine上指定了密码,因此是否也不
DB_PASSWORD
其填写到第一个DB_PASSWORD
字段中?
Make sure you are editing the wp-config.php
file inside the wordpress
directory. 确保您正在编辑
wordpress
目录中的wp-config.php
文件。 That demo ships with another (sample) version outside the wordpress
directory, which causes confusion. 该演示版在
wordpress
目录外附带了另一个(示例)版本,这引起了混乱。
Also, you need the server location in the DB_HOST
section. 另外,您需要在
DB_HOST
部分中找到服务器位置。 For example, if in the US-Central district: 例如,如果在美国中部地区:
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&%^&');
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.