久しぶりの投稿である。今更ながら勉強がてらAWSにサーバ構築。結構Linuxコマンド等が変わっていて習び直し。
1. dnf コマンドで localinstall にてローカルへダウンロードを行う
$ sudo dnf localinstall https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm
2. dnf コマンドでインストール
$ sudo dnf install mysql-community-server mysql-community-client mysql-community-devel
3. インストールしたらmysqld を自動起動に設定する
$ sudo systemctl enable mysqld
4. MySQLサーバを起動する
$ sudo systemctl start mysqld
5. 初期パスワードは /var/log/mysqld.log に出力されているとのことなので下記を grep で抽出すると一時パスワードが取得できる
$ sudo cat /var/log/mysqld.log | grep 'A temporary password is generated for root@localhost:'
6. 上記で取得したパスワードをコピーして下記のパスワードにペーストする
$ mysql -u root -p
Enter password:
7. ログイン成功
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.4.4
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>
8. root のパスワードを変更しておく
mysql> set password for root@localhost='xxxxxxxx';
Query OK, 0 rows affected (0.01 sec)