Rocky Linux 9にMySQLをインストールする方法

環境
OSバージョンを確認します
# cat /etc/redhat-release
Rocky Linux release 9.0 (Blue Onyx)

操作方法
1.インストール可能MySQLバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dnf info mysql
メタデータの期限切れの最終確認: 0:00:10 時間前の 20221029193907秒 に 実施しました。
利用可能なパッケージ
名前 : mysql
バージョン : 8.0.30
リリース : 3.el9_0
Arch : x86_64
サイズ : 2.8 M
ソース : mysql-8.0.30-3.el9_0.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.
# dnf info mysql メタデータの期限切れの最終確認: 0:00:10 時間前の 2022年10月29日 19時39分07秒 に 実施しました。 利用可能なパッケージ 名前 : mysql バージョン : 8.0.30 リリース : 3.el9_0 Arch : x86_64 サイズ : 2.8 M ソース : mysql-8.0.30-3.el9_0.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.
# dnf info mysql
メタデータの期限切れの最終確認: 0:00:10 時間前の 2022年10月29日 19時39分07秒 に 実施しました。
利用可能なパッケージ
名前         : mysql
バージョン   : 8.0.30
リリース     : 3.el9_0
Arch         : x86_64
サイズ       : 2.8 M
ソース       : mysql-8.0.30-3.el9_0.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.

2.MySQlをインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo dnf install mysql mysql-server --allowerasing --nobest
# sudo dnf install mysql mysql-server --allowerasing --nobest
# sudo dnf install mysql mysql-server --allowerasing --nobest

3.MySQLバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# mysql --version
mysql Ver 8.0.30 for Linux on x86_64 (Source distribution)
# mysql --version mysql Ver 8.0.30 for Linux on x86_64 (Source distribution)
# mysql --version
mysql Ver 8.0.30 for Linux on x86_64 (Source distribution)

4.MySQL自動起動の設定と起動します。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo systemctl enable --now mysqld
# sudo systemctl enable --now mysqld
# sudo systemctl enable --now mysqld

起動
# sudo systemctl start mysqld
停止
# sudo systemctl stop mysqld

ステータスを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl status mysqld
# systemctl status mysqld
# systemctl status mysqld

 

Rocky Linux 9

Posted by arkgame