業務用エアコン関連の技術情報、エラーコード、環境問題対策に関する別サイト「エアコンの安全な修理・適切なフロン回収」

AlmaLinux10.1 : MySQL8 , WordPressインストール

MySQL8 インストール

charset.cnf 下記の内容で新規作成
デフォルトの文字コードを設定 絵文字等 4 バイト長の文字を扱う場合はutf8mb4

完了したら、 「mysql_secure_installation」 コマンドを使用してrootユーザーのパスワードを設定し、いくつかの基本的なポリシーを設定します

# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No:y
Please set the password for root here.

New password:[password]

Re-enter new password:[password]
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y

  • Dropping test database…
    Success.
  • Removing privileges on test database…
    Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

WordPressインストール

1.MySQL8.4の設定変更

MySQL8.4では、"mysql_native_password"認証プラグインがデフォルトで無効になり、"caching_sha2_password"になっています。
"mysql_native_password"認証プラグインを利用するため設定ファイルの [mysqld] セクションに、以下のように設定を追加します。

2. Word Press 用のデータベースを作成

例としてデータベース[wp_db] データベースユーザー[wp_user] パスワード[?Ww123456]とします

# mysql -u root -p

Enter password: ←MySQL 用root パスワード入力します(画面上は表示されません)
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.4.6 Source distribution

Copyright (c) 2000, 2025, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE wp_db DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Query OK, 1 row affected, 2 warnings (0.00 sec)

mysql> CREATE USER 'wp_user'@'localhost' IDENTIFIED WITH mysql_native_password BY '?Ww123456';
Query OK, 0 rows affected (0.01 sec)

mysql> GRANT ALL ON wp_db.* TO 'wp_user'@'localhost';
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

3.Wordpressインストール

4.Wordpress設定ファイルの編集

また、最終行に以下の分を追加します。 これをしないと、プラグインを追加するときにFTP接続情報なるものを聞かれます。
define('FS_METHOD', 'direct');

5.ファイルの移動

①/var/www/html/[wordpress用ドメイン名]の下に展開した中身を移動

移動されたことを確認後 wordpressディレクトリーとダウンロードしたlatest-ja.tar.gzを削除

wordpressディレクトリの所有者をapacheにします。

6.wordpress インストールの開始

ブラウザでhttp://[FQDN]/wp-admin/install.phpにアクセスし、ユーザー名、パスワード等必要事項を入力し、インストールを開始してください

「お使いのサーバーの PHP では WordPress に必要な MySQL 拡張を利用できないようです。mysqli PHP 拡張機能がインストールされ、有効になっていることを確認してください。」
上記が表示されたら 次をインストールしてapacheとmysqlを再起動する

[ログイン]をクリック

ユーザー名 : 先ほど設定したユーザー名
パスワード : 先ほど設定したユーザーのパスワード
を入力し、[ログイン]をクリック

ログインに成功すると下記WordPressの管理画面にアクセスできます

タイトルとURLをコピーしました