CentOS Stream 9 にMySQL8.0.29をインストールする

環境
OSバージョンの確認
# cat /etc/redhat-release
CentOS Stream release 9

MySQLのインストール手順
1.mysqlのバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dnf info mysql
CentOS Stream 9 - BaseOS 3.1 kB/s | 4.6 kB 00:01
CentOS Stream 9 - AppStream 3.6 kB/s | 4.7 kB 00:01
CentOS Stream 9 - CRB 3.9 kB/s | 4.6 kB 00:01
CentOS Stream 9 - Extras packages 6.1 kB/s | 5.0 kB 00:00
# dnf info mysql CentOS Stream 9 - BaseOS 3.1 kB/s | 4.6 kB 00:01 CentOS Stream 9 - AppStream 3.6 kB/s | 4.7 kB 00:01 CentOS Stream 9 - CRB 3.9 kB/s | 4.6 kB 00:01 CentOS Stream 9 - Extras packages 6.1 kB/s | 5.0 kB 00:00
# dnf info mysql
CentOS Stream 9 - BaseOS                        3.1 kB/s | 4.6 kB     00:01
CentOS Stream 9 - AppStream                     3.6 kB/s | 4.7 kB     00:01
CentOS Stream 9 - CRB                           3.9 kB/s | 4.6 kB     00:01
CentOS Stream 9 - Extras packages               6.1 kB/s | 5.0 kB     00:00

2.利用可能なパッケージの確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
名前 : mysql
バージョン : 8.0.28
リリース : 1.el9
Arch : x86_64
サイズ : 2.6 M
ソース : mysql-8.0.28-1.el9.src.rpm
リポジトリー : appstream
概要 : MySQL client programs and shared libraries
URL : http://www.mysql.com
ライセンス : GPLv2 with exceptions and LGPLv2 and BSD
名前 : mysql バージョン : 8.0.28 リリース : 1.el9 Arch : x86_64 サイズ : 2.6 M ソース : mysql-8.0.28-1.el9.src.rpm リポジトリー : appstream 概要 : MySQL client programs and shared libraries URL : http://www.mysql.com ライセンス : GPLv2 with exceptions and LGPLv2 and BSD
名前         : mysql
バージョン   : 8.0.28
リリース     : 1.el9
Arch         : x86_64
サイズ       : 2.6 M
ソース       : mysql-8.0.28-1.el9.src.rpm
リポジトリー : appstream
概要         : MySQL client programs and shared libraries
URL          : http://www.mysql.com
ライセンス   : GPLv2 with exceptions and LGPLv2 and BSD

3.MySQLリポジトリのインストール

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dnf localinstall https://dev.mysql.com/get/mysql80-community-release-el8-3.noarch.rpm
# dnf localinstall https://dev.mysql.com/get/mysql80-community-release-el8-3.noarch.rpm
# dnf localinstall https://dev.mysql.com/get/mysql80-community-release-el8-3.noarch.rpm

4.MySQL最新パッケージの確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dnf info mysql-community-server
メタデータの期限切れの最終確認: 0:00:45 時間前の 20220620070627秒 に 実施しました。
利用可能なパッケージ
名前 : mysql-community-server
バージョン : 8.0.29
リリース : 1.el8
Arch : x86_64
サイズ : 53 M
ソース : mysql-community-8.0.29-1.el8.src.rpm
リポジトリー : mysql80-community
概要 : A very fast and reliable SQL database server
URL : http://www.mysql.com/
# dnf info mysql-community-server メタデータの期限切れの最終確認: 0:00:45 時間前の 2022年06月20日 07時06分27秒 に 実施しました。 利用可能なパッケージ 名前 : mysql-community-server バージョン : 8.0.29 リリース : 1.el8 Arch : x86_64 サイズ : 53 M ソース : mysql-community-8.0.29-1.el8.src.rpm リポジトリー : mysql80-community 概要 : A very fast and reliable SQL database server URL : http://www.mysql.com/
# dnf info mysql-community-server
メタデータの期限切れの最終確認: 0:00:45 時間前の 2022年06月20日 07時06分27秒 に 実施しました。
利用可能なパッケージ
名前         : mysql-community-server
バージョン   : 8.0.29
リリース     : 1.el8
Arch         : x86_64
サイズ       : 53 M
ソース       : mysql-community-8.0.29-1.el8.src.rpm
リポジトリー : mysql80-community
概要         : A very fast and reliable SQL database server
URL          : http://www.mysql.com/


5.MySQLのインストール

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

6.MySQLバージョンの確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# mysqld --version
/usr/sbin/mysqld Ver 8.0.29 for Linux on x86_64 (MySQL Community Server - GPL)
# mysqld --version /usr/sbin/mysqld Ver 8.0.29 for Linux on x86_64 (MySQL Community Server - GPL)
# mysqld --version
/usr/sbin/mysqld  Ver 8.0.29 for Linux on x86_64 (MySQL Community Server - GPL)

7.MySQL自動起動設定
# systemctl enable mysqld

MySQL起動
# systemctl start mysqld

MySQLステータスを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor pr>
Active: active (running) since Mon 2022-06-20 07:11:38 JST; 3s ago
# systemctl status mysqld ● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor pr> Active: active (running) since Mon 2022-06-20 07:11:38 JST; 3s ago
# systemctl status mysqld
● mysqld.service - MySQL Server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor pr>
     Active: active (running) since Mon 2022-06-20 07:11:38 JST; 3s ago

8.MySQLの一時パスワードを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# head -n 5 /var/log/mysqld.log
2022-06-19T22:11:13.030714Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.29) initializing of server in progress as process 27125
2022-06-19T22:11:13.580087Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-06-19T22:11:20.368382Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-06-19T22:11:23.515029Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: gf4HNYK5ua=3
2022-06-19T22:11:31.577639Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.29) starting as process 28481
# head -n 5 /var/log/mysqld.log 2022-06-19T22:11:13.030714Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.29) initializing of server in progress as process 27125 2022-06-19T22:11:13.580087Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2022-06-19T22:11:20.368382Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2022-06-19T22:11:23.515029Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: gf4HNYK5ua=3 2022-06-19T22:11:31.577639Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.29) starting as process 28481
# head -n 5 /var/log/mysqld.log
2022-06-19T22:11:13.030714Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.29) initializing of server in progress as process 27125
2022-06-19T22:11:13.580087Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-06-19T22:11:20.368382Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-06-19T22:11:23.515029Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: gf4HNYK5ua=3
2022-06-19T22:11:31.577639Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.29) starting as process 28481

9.MySQLに接続します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# mysql -u root -p
Enter password: #パスワード入力
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.29
Copyright (c) 2000, 2022, 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>
# mysql -u root -p Enter password: #パスワード入力 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.29 Copyright (c) 2000, 2022, 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>
# mysql -u root -p
Enter password:   #パスワード入力
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.29

Copyright (c) 2000, 2022, 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>

 

CentOS Stream 9

Posted by arkgame