按照Google App Engine创建本地WordPress开发平台的说明,我使用指令的MySQL方向创建了数据库和初始用户:
我在SQL上创建了一个用户,创建了实例,允许访问但我一直收到错误
Error establishing a database connection
以下是我的wp-config.php
文件:
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', 'wordpresstest');
/** 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/wordpresstest-1382:wordpresstest');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
} else {
/** The name of the local database for WordPress */
define('DB_NAME', 'wordpresstest');
/** Local environment MySQL login info */
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
}
以下是我的app.yaml
文件:
# [START env]
env_variables:
# Replace project, instance, database, user and password with the values obtained
# when configuring your Cloud SQL instance.
MYSQL_DSN: mysql:unix_socket=/cloudsql/wordpresstest-1382:wordpresstest;dbname=wordpresstest
MYSQL_USER: root
MYSQL_PASSWORD: ''
# [END env]
当我在Google Cloud Launcher上运行localhost时,仍然会收到错误。