AlmaLinux Mysql8をインストールする

AlmaLinuxにmysql8をインストールする手順です。
環境
OS AlmaLinux 8.3
Mysql8インストール
mysql8をインストールするまえに、以下のコマンドでバージョンを確認しておきます。
dnf info mysql
<出力結果>
利用可能なパッケージ
名前 : mysql
バージョン : 8.0.21
リリース : 1.module_el8.3.0+2049+47abd494
Arch : x86_64
サイズ : 12 M
ソース : mysql-8.0.21-1.module_el8.3.0+2049+47abd494.src.rpm
リポジトリー : appstream
概要 : MySQL client programs and shared libraries
URL : http://www.mysql.com
ライセンス : GPLv2 with exceptions and LGPLv2 and BSD
説明 : MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
: client/server implementation consisting of a server daemon (mysqld)
: and many different client programs and libraries. The base package
: contains the standard MySQL client programs and generic MySQL files.
8.0.21なので、そのままインストールを実行します。
## インストール
sudo dnf install @mysql:8.0
インストールが終われば、バージョンを確認してみます。
mysql --version
<出力結果>
mysql Ver 8.0.21 for Linux on x86_64 (Source distribution)
自動起動の設定と、起動を行います。
sudo systemctl enable --now mysqld
初期設定を行います
## 初期設定
mysql_secure_installation
<出力結果>
## パスワード設定
Press y|Y for Yes, any other key for No: y
## パスワードのポリシー設定 2を選択
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
## rootのパスワードの設定
New password:
Re-enter new password:
## 設定したパスワードで問題なければ y
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
## 匿名ユーザーはいらないので y
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
## rootでのリモート接続はさせないので y
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
## テストDBは不要なので y
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
## 設定を反映させるので y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
さきほど作成したパスワードで接続してみます。
mysql -u root -p
Enter password さきほど設定したパスワードを入力
ログインできれば設定が反映されています。

-
前の記事
javascript multiple属性の設定を変更する 2021.06.04
-
次の記事
go言語 パスが絶対パスであるかを判定する 2021.06.04
コメントを書く