wordpress + nginx + mysql: wordpress の起動と実行に関する問題 (エラーによりデータベース接続を確立できません)

wordpress + nginx + mysql: wordpress の起動と実行に関する問題 (エラーによりデータベース接続を確立できません)

私は nginx と gunicorn を使用して django アプリをデプロイし、昨日、WordPress ページをランドページとして含めるように設定を変更しようとしました。

基本的なインストールについてはこのチュートリアルに従いましたhttps://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lemp-on-ubuntu-18-04 そして、データベース接続エラーが繰り返し発生するため、WordPress ページを表示できません。それ以来ずっとインターネットで検索していますが、助けが必要だと認めざるを得ません。何が起こっているのかわかりません。

私のetc/nginx/sites-available/confは次のとおりです:

server {
    server_name  example.com www.example.com;
    root /var/www/html;
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/myexample.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/myexample.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


 index index.php index.html index.htm index.nginx-debian.html;

location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt { log_not_found off; access_log off; allow all; }
    location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
        expires max;
        log_not_found off;
    }


location / {
        #try_files $uri $uri/ =404;
        try_files $uri $uri/ /index.php$is_args$args;
    }
location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php7.2-fpm.sock;

}

そして、ここに私のWordPress confファイルが/var/www/html/wp-config.phpにあります。

define('WP_HOME','https://www.myexample.com');
define('WP_SITEURL','https://www.myexample.com');

define( 'DB_NAME', 'db1' );

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

/** MySQL database password */
define( 'DB_PASSWORD', 'mypassword' );

/** MySQL hostname */
define( 'DB_HOST', 'db1.cve345mgm.eu-west-3.rds.amazonaws.com' );

/** 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', '' );

define('AUTH_KEY',         'authkeypassword');
define('SECURE_AUTH_KEY',  'secureauthkeypassword');
define('LOGGED_IN_KEY',    'loggedinkeypassword');
define('NONCE_KEY',        'noncekeypassword');
define('AUTH_SALT',        'authsaltpass');
define('SECURE_AUTH_SALT', 'securauthsaltpass');
define('LOGGED_IN_SALT',   'loggedinsaltpass');
define('NONCE_SALT',       'Mnocnesaltpass');




define('FS_METHOD','direct');
define( 'WP_DEBUG', false );

/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
        define( 'ABSPATH', __DIR__ . '/' );
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';

define('WP_ALLOW_REPAIR', true);

このファイル内のパスワードは、mysql で設定したパスワードと同一であることを確認できます。

次のコマンドを使用して mysql に接続しようとすると:

mysql -u myser -h db1.cve345mgm.eu-west-3.rds.amazonaws.com -p 

次のエラーが発生します:

ERROR 2003 (HY000): Can't connect to MySQL server on 'db1.cve345mgm.eu-west-3.rds.amazonaws.com' (110).

ただし、nmap を使用してホスト接続を確認したところ、正常に動作しています。

All 1000 scanned ports on db1.cve345mgm.eu-west-3.rds.amazonaws.com (xxx.xx.xxx) are filtered

Nmap done: 1 IP address (1 host up) scanned in 82.14 seconds

さらに、mysql-log の出力は次のとおりです。

2020-08-31T23:21:58.350728Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentat$
2020-08-31T23:21:58.352669Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.31-0ubuntu0.18.04.1) starting as process 26674 ...
2020-08-31T23:21:58.357638Z 0 [Warning] One can only use the --user switch if running as root

2020-08-31T23:21:58.360084Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-08-31T23:21:58.360107Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-08-31T23:21:58.360112Z 0 [Note] InnoDB: Uses event mutexes
2020-08-31T23:21:58.360116Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-08-31T23:21:58.360121Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-08-31T23:21:58.360125Z 0 [Note] InnoDB: Using Linux native AIO
2020-08-31T23:21:58.360371Z 0 [Note] InnoDB: Number of pools: 1
2020-08-31T23:21:58.360478Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-08-31T23:21:58.365097Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-08-31T23:21:58.374004Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-08-31T23:21:58.376393Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-08-31T23:21:58.388238Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-08-31T23:21:58.397442Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-08-31T23:21:58.397496Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-08-31T23:21:58.433771Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-08-31T23:21:58.434521Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-08-31T23:21:58.434533Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-08-31T23:21:58.434820Z 0 [Note] InnoDB: Waiting for purge to start
2020-08-31T23:21:58.485059Z 0 [Note] InnoDB: 5.7.31 started; log sequence number 2750396
2020-08-31T23:21:58.485458Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-08-31T23:21:58.491549Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-08-31T23:21:58.492694Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200831 23:21:58
2020-08-31T23:21:58.493566Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2020-08-31T23:21:58.493576Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2020-08-31T23:21:58.494126Z 0 [Warning] CA certificate ca.pem is self signed.
2020-08-31T23:21:58.494160Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2020-08-31T23:21:58.494227Z 0 [Note] Server hostname (bind-address): 'db1.cve345mgm.eu-west-3.rds.amazonaws.com'; port: 3306
2020-08-31T23:21:58.497633Z 0 [Note]   - 'db1.cve345mgm.eu-west-3.rds.amazonaws.com' resolves to 'xxx.xx.xx.x';
2020-08-31T23:21:58.499484Z 0 [Note] Server socket created on IP: 'xxx.xx.xx.x'.
2020-08-31T23:21:58.499502Z 0 [ERROR] Can't start server: Bind on TCP/IP port: Cannot assign requested address
2020-08-31T23:21:58.499507Z 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2020-08-31T23:21:58.499540Z 0 [ERROR] Aborting

そしてnginx-log:

2020/08/31 19:33:45 [alert] 25670#25670: *62 open socket #15 left in connection 4
2020/08/31 19:33:45 [alert] 25670#25670: *61 open socket #14 left in connection 5
2020/08/31 19:33:45 [alert] 25670#25670: *63 open socket #16 left in connection 6
2020/08/31 19:33:45 [alert] 25670#25670: *59 open socket #3 left in connection 7
2020/08/31 19:33:45 [alert] 25670#25670: *60 open socket #13 left in connection 8
2020/08/31 19:33:45 [alert] 25670#25670: *64 open socket #17 left in connection 9
2020/08/31 19:33:45 [alert] 25670#25670: aborting

実行しようとすると、sudo service mysql restart 次のエラーが発生します。

● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2020-08-31 22:13:50 UTC; 12s ago
  Process: 27253 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=0/SUCCESS)
  Process: 28990 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
 Main PID: 27255 (code=exited, status=0/SUCCESS)

Aug 31 22:13:49 ip systemd[1]: mysql.service: Control process exited, code=exited status=1
Aug 31 22:13:49 ip systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 31 22:13:49 ip systemd[1]: Failed to start MySQL Community Server.
Aug 31 22:13:50 ip systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Aug 31 22:13:50 ip systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Aug 31 22:13:50 ip systemd[1]: Stopped MySQL Community Server.
Aug 31 22:13:50 ip systemd[1]: mysql.service: Start request repeated too quickly.
Aug 31 22:13:50 ip systemd[1]: mysql.service: Failed with result 'exit-code'.
Aug 31 22:13:50 ip systemd[1]: Failed to start MySQL Community Server.

更新: ラインを詳しく見てみると:

Process: 27253 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=0/SUCCESS)

に mysqld ディレクトリがないことに気が付きました。~/var/run/これが問題なのでしょうか?にmysqlディレクトリがあるのですvar/lib/が、そこに入る権限がないことがわかりましたcd。これはすべてとても奇妙に思えます!

見つけられる限りのことはすべて試しましたが、何も効果がないようです。私がどこで失敗しているのか、誰かにわかってもらえたらと思います。ありがとうございます

関連情報