EC2/EB 到 RDS 卡在只读状态(Wordpress 安装)

EC2/EB 到 RDS 卡在只读状态(Wordpress 安装)

我有一个可通过 SSH 访问的 Elastic Beanstalk 实例。我已下载 Wordpress 并将其解压到正确的目录。我可以从此目录和域提供文件。

我已经配置了 wp-config.php 文件:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', '!~?5tr0ngP@ssw0rd!~?');

/** MySQL hostname */
define('DB_HOST', 'wordpressblog.abcdefgh.eu-west-1.rds.amazonaws.com:3306');

我也从这里生成了身份验证密钥/盐:https://api.wordpress.org/secret-key/1.1/salt/

连接到我的域名 (blog./wp-admin/install.php) 后,我填写了创建用户、密码和博客标题的表单。继续执行第 2 步,错误:WordPress 数据库错误:[MySQL 服务器正在使用 --read-only 选项运行,因此无法执行此语句]

就 AWS 安全组而言,我可以通过 SSH 进入 EB/EC2 实例,并通过 mysql -h 进入 RDS 实例。

  • 使用 MySQL 命令行执行 INSERT:

  • 通过 SSH 进入 EB 实例(部分内容已匿名)

  • mysql -h wordpressblog.abcdefgh.eu-west-1.rds.amazonaws.com -u 根 -p

  • 要求输入密码,我输入后,它接受。

  • 显示数据库显示我之前使用 MySQL Workbench 创建的“wordpress”数据库:

    mysql>显示数据库;

    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | wordpress          |
    +--------------------+
     * mysql> use wordpress;
     * create table test
    

输出:

mysql> create table test;
ERROR 1290 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement

输出如下:

mysql -h wordpressblog.abcdefgh.eu-west-1.rds.amazonaws.com -u root -p -e 'SHOW GRANTS; SELECT @@READ_ONLY;'

+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@%                                                                                                                                                                                                                                                                                                                                                                                               |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, LOAD FROM S3 ON *.* TO 'root'@'%' IDENTIFIED BY PASSWORD '*4799CE6D6F3B146932C3716AD5B832561976A479' WITH GRANT OPTION |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+-------------+
| @@READ_ONLY |
+-------------+
|           0 |
+-------------+

我怎样才能绕过这个只读问题?

相关内容