AlmaLinux 8.4 にMySQL 8.0.26をインストールする
OSバージョンの確認
# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch Distributor ID: AlmaLinux Description: AlmaLinux release 8.4 (Electric Cheetah) Release: 8.4 Codename: ElectricCheetah
1.有効バージョンmysqlを確認
# dnf info mysql 名前 : mysql バージョン : 8.0.26 リリース : 1.module_el8.4.0+2532+b8928c02 Arch : x86_64 サイズ : 12 M ソース : mysql-8.0.26-1.module_el8.4.0+2532+b8928c02.src.rpm リポジトリー : appstream 概要 : MySQL client programs and shared libraries
2.mysqlをインストール
# sudo dnf install @mysql:8.0
バージョンを確認
# mysql –version
mysql Ver 8.0.26 for Linux on x86_64 (Source distribution)
自動起動を設定
# sudo systemctl enable --now mysqld Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service
3.mysqlの初期設定を行う
# 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 There are three levels of password validation policy: LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and special characters STRONG Length >= 8, numeric, mixed case, special characters and dictionary file ## パスワードの強度 2 数字、大文字と小文字、特殊文字、辞書 Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2 Please set the password for root here. ## パスワード入力 New password: ## 確認パスワード Re-enter new password: Estimated strength of the password: 100 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y 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!
4.MySQLの接続確認
# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 13 Server version: 8.0.26 Source distribution Copyright (c) 2000, 2021, 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> select version(); +-----------+ | version() | +-----------+ | 8.0.26 | +-----------+ 1 row in set (0.00 sec) mysql> status -------------- mysql Ver 8.0.26 for Linux on x86_64 (Source distribution) Connection id: 13 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 8.0.26 Source distribution Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: utf8mb4 Conn. characterset: utf8mb4 UNIX socket: /var/lib/mysql/mysql.sock Binary data as: Hexadecimal Uptime: 13 min 0 sec Threads: 2 Questions: 26 Slow queries: 0 Opens: 133 Flush tables: 3 Open tables: 49 Queries per second avg: 0.033