Php 使用GAE部署Wordpress时出现问题-本地运行正常
我正确设置了CloudSQL实例,wordpress在本地正常运行。 当我尝试运行以下命令时,其中INSTANCE_IP是我的云SQL实例的IP地址,我的语法出现错误:Php 使用GAE部署Wordpress时出现问题-本地运行正常,php,mysql,wordpress,google-app-engine,google-cloud-sql,Php,Mysql,Wordpress,Google App Engine,Google Cloud Sql,我正确设置了CloudSQL实例,wordpress在本地正常运行。 当我尝试运行以下命令时,其中INSTANCE_IP是我的云SQL实例的IP地址,我的语法出现错误: {PATH_TO_MYSQL_BIN}/mysql --host=INSTANCE_IP --user=root --password create database wordpress_db; exit; 编辑,错误消息: {PATH_TO_MYSQL_BIN}/mysql --host=xxx.19x.2xx.xx --u
{PATH_TO_MYSQL_BIN}/mysql --host=INSTANCE_IP --user=root --password
create database wordpress_db;
exit;
编辑,错误消息:
{PATH_TO_MYSQL_BIN}/mysql --host=xxx.19x.2xx.xx --user=root --password -> create database wordpress_db; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{PATH_TO_MYSQL_BIN}/mysql --host=173.194.243.33 --user=root --password create da' at line 1
如果有人能告诉我我的语法有什么问题,那就太好了,提前谢谢。
以下是我认为相关的wp-config.php:
// Required for batcache use
define('WP_CACHE', true);
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress_db');
/** MySQL database username */
define('DB_USER', 'root');
if (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) {
/** Live environment Cloud SQL login and SITE_URL info */
define('DB_HOST', ':/cloudsql/your-project-id:wordpress');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
} else {
/** Local environment MySQL login info */
define('DB_HOST', '127.0.0.1');
define('DB_USER', 'root');
define('DB_PASSWORD', 'password');
}
// Determine HTTP or HTTPS, then set WP_SITEURL and WP_HOME
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443)
{
$protocol_to_use = 'https://';
} else {
$protocol_to_use = 'http://';
}
define( 'WP_SITEURL', $protocol_to_use . $_SERVER['HTTP_HOST']);
define( 'WP_HOME', $protocol_to_use . $_SERVER['HTTP_HOST']);
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
看起来您正在遵循谷歌云项目网站上的指南 以下是一些解决方案:
- 首先,如果您在mysql安装期间更改了用户名或密码,请确保在config.php for wordpress中对其进行更新
- 这里有一件事——在MySQL中,如果您使用的是工作台,那么您需要运行的就是: 创建数据库wordpress\u db强>
另一个脚本是,如果您是从cmd工具运行它,我相信。您至少需要包含错误消息才能得到正确的答案。包括在内,谢谢您的评论。您是同时运行
创建数据库
命令和登录,还是先登录,输入密码后再创建?我真的想:{PATH_TO_MYSQL_BIN}/MYSQL--host=xxx.19x.2xx.xx--user=root--password-create-database-wordpress_-db;您是否尝试对数据库名称使用反勾号?至少对于数据库名称中的破折号,这通常会奏效。