ConohaVPS

ConohaVPSのAlmaLinux8.5にMySQLをインストールする方法

デフォルトでは以下のようにmysqlは入っていないようです。

 command
[hogehoge@xxx-xxx-xxx-xxx ~]$ mysql --version
-bash: mysql: command not found

dnfコマンドでmysqlのバージョン等の情報を取得します。
8.0.26のようです。

 command
[hogehoge@xxx-xxx-xxx-xxx ~]$ dnf info mysql
AlmaLinux 8 - BaseOS 3.0 MB/s | 5.9 MB 00:01
AlmaLinux 8 - AppStream 5.5 MB/s | 9.1 MB 00:01
AlmaLinux 8 - Extras 13 kB/s | 12 kB 00:00
Extra Packages for Enterprise Linux 8 - x86_64 12 MB/s | 11 MB 00:00
Extra Packages for Enterprise Linux Modular 8 - 2.0 MB/s | 979 kB 00:00
Available Packages
Name : mysql
Version : 8.0.26
Release : 1.module_el8.4.0+2532+b8928c02
Architecture : x86_64
Size : 12 M
Source : mysql-8.0.26-1.module_el8.4.0+2532+b8928c02.src.rpm
Repository : appstream
Summary : MySQL client programs and shared libraries
URL : http://www.mysql.com
License : GPLv2 with exceptions and LGPLv2 and BSD
Description : 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コマンドでmysqlをインストールします。

 command
[hogehoge@xxx-xxx-xxx-xxx ~]$ sudo dnf install mysql
[sudo] password for hogehoge:
Waiting for process with pid 1616 to finish.
Last metadata expiration check: 0:00:06 ago on Sun 13 Feb 2022 06:39:20 PM JST.
Dependencies resolved.
================================================================================
Package Arch Version Repo Size
================================================================================
Installing:
mysql x86_64 8.0.26-1.module_el8.4.0+2532+b8928c02 appstream 12 M
Installing dependencies:
mariadb-connector-c-config
noarch 3.1.11-2.el8_3 appstream 14 k
mysql-common x86_64 8.0.26-1.module_el8.4.0+2532+b8928c02 appstream 133 k
Enabling module streams:
mysql 8.0
Transaction Summary
================================================================================
Install 3 Packages
Total download size: 12 M
Installed size: 63 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): mariadb-connector-c-config-3.1.11-2.el8_ 366 kB/s | 14 kB 00:00
(2/3): mysql-common-8.0.26-1.module_el8.4.0+253 1.6 MB/s | 133 kB 00:00
(3/3): mysql-8.0.26-1.module_el8.4.0+2532+b8928 16 MB/s | 12 MB 00:00
--------------------------------------------------------------------------------
Total 7.8 MB/s | 12 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mariadb-connector-c-config-3.1.11-2.el8_3.noarch 1/3
Installing : mysql-common-8.0.26-1.module_el8.4.0+2532+b8928c02.x 2/3
Installing : mysql-8.0.26-1.module_el8.4.0+2532+b8928c02.x86_64 3/3
Running scriptlet: mysql-8.0.26-1.module_el8.4.0+2532+b8928c02.x86_64 3/3
Verifying : mariadb-connector-c-config-3.1.11-2.el8_3.noarch 1/3
Verifying : mysql-8.0.26-1.module_el8.4.0+2532+b8928c02.x86_64 2/3
Verifying : mysql-common-8.0.26-1.module_el8.4.0+2532+b8928c02.x 3/3
Installed:
mariadb-connector-c-config-3.1.11-2.el8_3.noarch
mysql-8.0.26-1.module_el8.4.0+2532+b8928c02.x86_64
mysql-common-8.0.26-1.module_el8.4.0+2532+b8928c02.x86_64
Complete!

以下のように8.0.26のMySQLがインストールされました。

 command
[hogehoge@xxx-xxx-xxx-xxx ~]$ mysql --version
mysql Ver 8.0.26 for Linux on x86_64 (Source distribution)

mysql-serverもインストールします。

 command
[hogehoge@xxx-xxx-xxx-xxx ~]$ sudo dnf install mysql-server
Last metadata expiration check: 1:04:39 ago on Sun 13 Feb 2022 06:39:20 PM JST.
Dependencies resolved.
================================================================================
Package Arch Version Repo Size
================================================================================
Installing:
mysql-server x86_64 8.0.26-1.module_el8.4.0+2532+b8928c02
appstream 25 M
Installing dependencies:
libevent x86_64 2.1.8-5.el8 baseos 253 k
mecab x86_64 0.996-1.module_el8.4.0+2532+b8928c02.9
appstream 392 k
mysql-errmsg x86_64 8.0.26-1.module_el8.4.0+2532+b8928c02
appstream 597 k
perl-Carp noarch 1.42-396.el8 baseos 30 k
perl-Data-Dumper x86_64 2.167-399.el8 baseos 58 k
perl-Digest noarch 1.17-395.el8 appstream 27 k
perl-Digest-MD5 x86_64 2.55-396.el8 appstream 37 k
perl-Encode x86_64 4:2.97-3.el8 baseos 1.5 M
perl-Errno x86_64 1.28-420.el8 baseos 75 k
perl-Exporter noarch 5.72-396.el8 baseos 34 k
perl-File-Path noarch 2.15-2.el8 baseos 38 k
perl-File-Temp noarch 0.230.600-1.el8 baseos 62 k
perl-Getopt-Long noarch 1:2.50-4.el8 baseos 63 k
perl-HTTP-Tiny noarch 0.074-1.el8 baseos 58 k
perl-IO x86_64 1.38-420.el8 baseos 141 k
perl-MIME-Base64 x86_64 3.15-396.el8 baseos 30 k
perl-Net-SSLeay x86_64 1.88-1.module_el8.3.0+2086+72f2d257
appstream 378 k
perl-PathTools x86_64 3.74-1.el8 baseos 90 k
perl-Pod-Escapes noarch 1:1.07-395.el8 baseos 20 k
perl-Pod-Perldoc noarch 3.28-396.el8 baseos 86 k
perl-Pod-Simple noarch 1:3.35-395.el8 baseos 213 k
perl-Pod-Usage noarch 4:1.69-395.el8 baseos 34 k
perl-Scalar-List-Utils x86_64 3:1.49-2.el8 baseos 68 k
perl-Socket x86_64 4:2.027-3.el8 baseos 59 k
perl-Storable x86_64 1:3.11-3.el8 baseos 98 k
perl-Term-ANSIColor noarch 4.06-396.el8 baseos 46 k
perl-Term-Cap noarch 1.17-395.el8 baseos 23 k
perl-Text-ParseWords noarch 3.30-395.el8 baseos 18 k
perl-Text-Tabs+Wrap noarch 2013.0523-395.el8 baseos 24 k
perl-Time-Local noarch 1:1.280-1.el8 baseos 33 k
perl-URI noarch 1.73-3.el8 appstream 116 k
perl-Unicode-Normalize x86_64 1.25-396.el8 baseos 82 k
perl-constant noarch 1.33-396.el8 baseos 25 k
perl-interpreter x86_64 4:5.26.3-420.el8 baseos 6.3 M
perl-libnet noarch 3.11-3.el8 appstream 121 k
perl-libs x86_64 4:5.26.3-420.el8 baseos 1.6 M
perl-macros x86_64 4:5.26.3-420.el8 baseos 71 k
perl-parent noarch 1:0.237-1.el8 baseos 20 k
perl-podlators noarch 4.11-1.el8 baseos 118 k
perl-threads x86_64 1:2.21-2.el8 baseos 61 k
perl-threads-shared x86_64 1.58-2.el8 baseos 47 k
policycoreutils-python-utils noarch 2.9-16.el8 baseos 251 k
protobuf-lite x86_64 3.5.0-13.el8 appstream 148 k
Installing weak dependencies:
perl-IO-Socket-IP noarch 0.39-5.el8 appstream 47 k
perl-IO-Socket-SSL noarch 2.066-4.module_el8.3.0+2086+72f2d257
appstream 297 k
perl-Mozilla-CA noarch 20160104-7.module_el8.3.0+2091+9eecfe51
appstream 14 k
Enabling module streams:
perl 5.26
perl-IO-Socket-SSL 2.066
perl-libwww-perl 6.34
Transaction Summary
================================================================================
Install 47 Packages
Total download size: 39 M
Installed size: 168 M
Is this ok [y/N]: y
Downloading Packages:
(1/47): perl-Carp-1.42-396.el8.noarch.rpm 659 kB/s | 30 kB 00:00
(2/47): perl-Data-Dumper-2.167-399.el8.x86_64.r 876 kB/s | 58 kB 00:00
(3/47): libevent-2.1.8-5.el8.x86_64.rpm 2.4 MB/s | 253 kB 00:00
(4/47): perl-Errno-1.28-420.el8.x86_64.rpm 1.8 MB/s | 75 kB 00:00
(5/47): perl-Exporter-5.72-396.el8.noarch.rpm 1.8 MB/s | 34 kB 00:00
(6/47): perl-File-Path-2.15-2.el8.noarch.rpm 2.3 MB/s | 38 kB 00:00
(7/47): perl-File-Temp-0.230.600-1.el8.noarch.r 3.5 MB/s | 62 kB 00:00
(8/47): perl-Getopt-Long-2.50-4.el8.noarch.rpm 2.0 MB/s | 63 kB 00:00
(9/47): perl-HTTP-Tiny-0.074-1.el8.noarch.rpm 2.3 MB/s | 58 kB 00:00
(10/47): perl-MIME-Base64-3.15-396.el8.x86_64.r 1.7 MB/s | 30 kB 00:00
(11/47): perl-IO-1.38-420.el8.x86_64.rpm 3.4 MB/s | 141 kB 00:00
(12/47): perl-PathTools-3.74-1.el8.x86_64.rpm 4.0 MB/s | 90 kB 00:00
(13/47): perl-Pod-Escapes-1.07-395.el8.noarch.r 1.1 MB/s | 20 kB 00:00
(14/47): perl-Pod-Perldoc-3.28-396.el8.noarch.r 4.2 MB/s | 86 kB 00:00
(15/47): perl-Pod-Usage-1.69-395.el8.noarch.rpm 2.0 MB/s | 34 kB 00:00
(16/47): perl-Pod-Simple-3.35-395.el8.noarch.rp 4.6 MB/s | 213 kB 00:00
(17/47): perl-Scalar-List-Utils-1.49-2.el8.x86_ 2.6 MB/s | 68 kB 00:00
(18/47): perl-Socket-2.027-3.el8.x86_64.rpm 3.4 MB/s | 59 kB 00:00
(19/47): perl-Storable-3.11-3.el8.x86_64.rpm 5.3 MB/s | 98 kB 00:00
(20/47): perl-Encode-2.97-3.el8.x86_64.rpm 5.5 MB/s | 1.5 MB 00:00
(21/47): perl-Term-ANSIColor-4.06-396.el8.noarc 1.6 MB/s | 46 kB 00:00
(22/47): perl-Term-Cap-1.17-395.el8.noarch.rpm 846 kB/s | 23 kB 00:00
(23/47): perl-Text-ParseWords-3.30-395.el8.noar 1.3 MB/s | 18 kB 00:00
(24/47): perl-Text-Tabs+Wrap-2013.0523-395.el8. 1.3 MB/s | 24 kB 00:00
(25/47): perl-Time-Local-1.280-1.el8.noarch.rpm 1.6 MB/s | 33 kB 00:00
(26/47): perl-Unicode-Normalize-1.25-396.el8.x8 3.9 MB/s | 82 kB 00:00
(27/47): perl-constant-1.33-396.el8.noarch.rpm 1.6 MB/s | 25 kB 00:00
(28/47): perl-macros-5.26.3-420.el8.x86_64.rpm 3.6 MB/s | 71 kB 00:00
(29/47): perl-parent-0.237-1.el8.noarch.rpm 1.1 MB/s | 20 kB 00:00
(30/47): perl-podlators-4.11-1.el8.noarch.rpm 2.0 MB/s | 118 kB 00:00
(31/47): perl-threads-2.21-2.el8.x86_64.rpm 2.6 MB/s | 61 kB 00:00
(32/47): perl-threads-shared-1.58-2.el8.x86_64. 2.9 MB/s | 47 kB 00:00
(33/47): perl-libs-5.26.3-420.el8.x86_64.rpm 9.3 MB/s | 1.6 MB 00:00
(34/47): policycoreutils-python-utils-2.9-16.el 5.7 MB/s | 251 kB 00:00
(35/47): mecab-0.996-1.module_el8.4.0+2532+b892 5.1 MB/s | 392 kB 00:00
(36/47): mysql-errmsg-8.0.26-1.module_el8.4.0+2 6.6 MB/s | 597 kB 00:00
(37/47): perl-Digest-1.17-395.el8.noarch.rpm 3.4 MB/s | 27 kB 00:00
(38/47): perl-interpreter-5.26.3-420.el8.x86_64 17 MB/s | 6.3 MB 00:00
(39/47): perl-Digest-MD5-2.55-396.el8.x86_64.rp 422 kB/s | 37 kB 00:00
(40/47): perl-IO-Socket-IP-0.39-5.el8.noarch.rp 2.5 MB/s | 47 kB 00:00
(41/47): perl-IO-Socket-SSL-2.066-4.module_el8. 12 MB/s | 297 kB 00:00
(42/47): perl-Mozilla-CA-20160104-7.module_el8. 741 kB/s | 14 kB 00:00
(43/47): perl-URI-1.73-3.el8.noarch.rpm 6.2 MB/s | 116 kB 00:00
(44/47): perl-Net-SSLeay-1.88-1.module_el8.3.0+ 12 MB/s | 378 kB 00:00
(45/47): perl-libnet-3.11-3.el8.noarch.rpm 3.2 MB/s | 121 kB 00:00
(46/47): protobuf-lite-3.5.0-13.el8.x86_64.rpm 5.7 MB/s | 148 kB 00:00
(47/47): mysql-server-8.0.26-1.module_el8.4.0+2 22 MB/s | 25 MB 00:01
--------------------------------------------------------------------------------
Total 10 MB/s | 39 MB 00:03
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : perl-Digest-1.17-395.el8.noarch 1/47
Installing : perl-Digest-MD5-2.55-396.el8.x86_64 2/47
Installing : perl-Data-Dumper-2.167-399.el8.x86_64 3/47
Installing : perl-libnet-3.11-3.el8.noarch 4/47
Installing : perl-Net-SSLeay-1.88-1.module_el8.3.0+2086+72f2d25 5/47
Installing : perl-URI-1.73-3.el8.noarch 6/47
Installing : perl-Pod-Escapes-1:1.07-395.el8.noarch 7/47
Installing : perl-Time-Local-1:1.280-1.el8.noarch 8/47
Installing : perl-IO-Socket-IP-0.39-5.el8.noarch 9/47
Installing : perl-Mozilla-CA-20160104-7.module_el8.3.0+2091+9ee 10/47
Installing : perl-IO-Socket-SSL-2.066-4.module_el8.3.0+2086+72f 11/47
Installing : perl-Term-ANSIColor-4.06-396.el8.noarch 12/47
Installing : perl-Term-Cap-1.17-395.el8.noarch 13/47
Installing : perl-File-Temp-0.230.600-1.el8.noarch 14/47
Installing : perl-Pod-Simple-1:3.35-395.el8.noarch 15/47
Installing : perl-HTTP-Tiny-0.074-1.el8.noarch 16/47
Installing : perl-podlators-4.11-1.el8.noarch 17/47
Installing : perl-Pod-Perldoc-3.28-396.el8.noarch 18/47
Installing : perl-Text-ParseWords-3.30-395.el8.noarch 19/47
Installing : perl-Pod-Usage-4:1.69-395.el8.noarch 20/47
Installing : perl-MIME-Base64-3.15-396.el8.x86_64 21/47
Installing : perl-Storable-1:3.11-3.el8.x86_64 22/47
Installing : perl-Getopt-Long-1:2.50-4.el8.noarch 23/47
Installing : perl-Errno-1.28-420.el8.x86_64 24/47
Installing : perl-Socket-4:2.027-3.el8.x86_64 25/47
Installing : perl-Encode-4:2.97-3.el8.x86_64 26/47
Installing : perl-Exporter-5.72-396.el8.noarch 27/47
Installing : perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 28/47
Installing : perl-macros-4:5.26.3-420.el8.x86_64 29/47
Installing : perl-parent-1:0.237-1.el8.noarch 30/47
Installing : perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch 31/47
Installing : perl-Unicode-Normalize-1.25-396.el8.x86_64 32/47
Installing : perl-File-Path-2.15-2.el8.noarch 33/47
Installing : perl-IO-1.38-420.el8.x86_64 34/47
Installing : perl-PathTools-3.74-1.el8.x86_64 35/47
Installing : perl-constant-1.33-396.el8.noarch 36/47
Installing : perl-threads-1:2.21-2.el8.x86_64 37/47
Installing : perl-threads-shared-1.58-2.el8.x86_64 38/47
Installing : perl-libs-4:5.26.3-420.el8.x86_64 39/47
Installing : perl-Carp-1.42-396.el8.noarch 40/47
Installing : perl-interpreter-4:5.26.3-420.el8.x86_64 41/47
Installing : protobuf-lite-3.5.0-13.el8.x86_64 42/47
Installing : mysql-errmsg-8.0.26-1.module_el8.4.0+2532+b8928c02 43/47
Installing : mecab-0.996-1.module_el8.4.0+2532+b8928c02.9.x86_6 44/47
Running scriptlet: mecab-0.996-1.module_el8.4.0+2532+b8928c02.9.x86_6 44/47
Installing : policycoreutils-python-utils-2.9-16.el8.noarch 45/47
Installing : libevent-2.1.8-5.el8.x86_64 46/47
Running scriptlet: mysql-server-8.0.26-1.module_el8.4.0+2532+b8928c02 47/47
Installing : mysql-server-8.0.26-1.module_el8.4.0+2532+b8928c02 47/47
Running scriptlet: mysql-server-8.0.26-1.module_el8.4.0+2532+b8928c02 47/47
ValueError: File context for /var/log/mysql(/.*)? already defined
Verifying : libevent-2.1.8-5.el8.x86_64 1/47
Verifying : perl-Carp-1.42-396.el8.noarch 2/47
Verifying : perl-Data-Dumper-2.167-399.el8.x86_64 3/47
Verifying : perl-Encode-4:2.97-3.el8.x86_64 4/47
Verifying : perl-Errno-1.28-420.el8.x86_64 5/47
Verifying : perl-Exporter-5.72-396.el8.noarch 6/47
Verifying : perl-File-Path-2.15-2.el8.noarch 7/47
Verifying : perl-File-Temp-0.230.600-1.el8.noarch 8/47
Verifying : perl-Getopt-Long-1:2.50-4.el8.noarch 9/47
Verifying : perl-HTTP-Tiny-0.074-1.el8.noarch 10/47
Verifying : perl-IO-1.38-420.el8.x86_64 11/47
Verifying : perl-MIME-Base64-3.15-396.el8.x86_64 12/47
Verifying : perl-PathTools-3.74-1.el8.x86_64 13/47
Verifying : perl-Pod-Escapes-1:1.07-395.el8.noarch 14/47
Verifying : perl-Pod-Perldoc-3.28-396.el8.noarch 15/47
Verifying : perl-Pod-Simple-1:3.35-395.el8.noarch 16/47
Verifying : perl-Pod-Usage-4:1.69-395.el8.noarch 17/47
Verifying : perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 18/47
Verifying : perl-Socket-4:2.027-3.el8.x86_64 19/47
Verifying : perl-Storable-1:3.11-3.el8.x86_64 20/47
Verifying : perl-Term-ANSIColor-4.06-396.el8.noarch 21/47
Verifying : perl-Term-Cap-1.17-395.el8.noarch 22/47
Verifying : perl-Text-ParseWords-3.30-395.el8.noarch 23/47
Verifying : perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch 24/47
Verifying : perl-Time-Local-1:1.280-1.el8.noarch 25/47
Verifying : perl-Unicode-Normalize-1.25-396.el8.x86_64 26/47
Verifying : perl-constant-1.33-396.el8.noarch 27/47
Verifying : perl-interpreter-4:5.26.3-420.el8.x86_64 28/47
Verifying : perl-libs-4:5.26.3-420.el8.x86_64 29/47
Verifying : perl-macros-4:5.26.3-420.el8.x86_64 30/47
Verifying : perl-parent-1:0.237-1.el8.noarch 31/47
Verifying : perl-podlators-4.11-1.el8.noarch 32/47
Verifying : perl-threads-1:2.21-2.el8.x86_64 33/47
Verifying : perl-threads-shared-1.58-2.el8.x86_64 34/47
Verifying : policycoreutils-python-utils-2.9-16.el8.noarch 35/47
Verifying : mecab-0.996-1.module_el8.4.0+2532+b8928c02.9.x86_6 36/47
Verifying : mysql-errmsg-8.0.26-1.module_el8.4.0+2532+b8928c02 37/47
Verifying : mysql-server-8.0.26-1.module_el8.4.0+2532+b8928c02 38/47
Verifying : perl-Digest-1.17-395.el8.noarch 39/47
Verifying : perl-Digest-MD5-2.55-396.el8.x86_64 40/47
Verifying : perl-IO-Socket-IP-0.39-5.el8.noarch 41/47
Verifying : perl-IO-Socket-SSL-2.066-4.module_el8.3.0+2086+72f 42/47
Verifying : perl-Mozilla-CA-20160104-7.module_el8.3.0+2091+9ee 43/47
Verifying : perl-Net-SSLeay-1.88-1.module_el8.3.0+2086+72f2d25 44/47
Verifying : perl-URI-1.73-3.el8.noarch 45/47
Verifying : perl-libnet-3.11-3.el8.noarch 46/47
Verifying : protobuf-lite-3.5.0-13.el8.x86_64 47/47
Installed:
libevent-2.1.8-5.el8.x86_64
mecab-0.996-1.module_el8.4.0+2532+b8928c02.9.x86_64
mysql-errmsg-8.0.26-1.module_el8.4.0+2532+b8928c02.x86_64
mysql-server-8.0.26-1.module_el8.4.0+2532+b8928c02.x86_64
perl-Carp-1.42-396.el8.noarch
perl-Data-Dumper-2.167-399.el8.x86_64
perl-Digest-1.17-395.el8.noarch
perl-Digest-MD5-2.55-396.el8.x86_64
perl-Encode-4:2.97-3.el8.x86_64
perl-Errno-1.28-420.el8.x86_64
perl-Exporter-5.72-396.el8.noarch
perl-File-Path-2.15-2.el8.noarch
perl-File-Temp-0.230.600-1.el8.noarch
perl-Getopt-Long-1:2.50-4.el8.noarch
perl-HTTP-Tiny-0.074-1.el8.noarch
perl-IO-1.38-420.el8.x86_64
perl-IO-Socket-IP-0.39-5.el8.noarch
perl-IO-Socket-SSL-2.066-4.module_el8.3.0+2086+72f2d257.noarch
perl-MIME-Base64-3.15-396.el8.x86_64
perl-Mozilla-CA-20160104-7.module_el8.3.0+2091+9eecfe51.noarch
perl-Net-SSLeay-1.88-1.module_el8.3.0+2086+72f2d257.x86_64
perl-PathTools-3.74-1.el8.x86_64
perl-Pod-Escapes-1:1.07-395.el8.noarch
perl-Pod-Perldoc-3.28-396.el8.noarch
perl-Pod-Simple-1:3.35-395.el8.noarch
perl-Pod-Usage-4:1.69-395.el8.noarch
perl-Scalar-List-Utils-3:1.49-2.el8.x86_64
perl-Socket-4:2.027-3.el8.x86_64
perl-Storable-1:3.11-3.el8.x86_64
perl-Term-ANSIColor-4.06-396.el8.noarch
perl-Term-Cap-1.17-395.el8.noarch
perl-Text-ParseWords-3.30-395.el8.noarch
perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch
perl-Time-Local-1:1.280-1.el8.noarch
perl-URI-1.73-3.el8.noarch
perl-Unicode-Normalize-1.25-396.el8.x86_64
perl-constant-1.33-396.el8.noarch
perl-interpreter-4:5.26.3-420.el8.x86_64
perl-libnet-3.11-3.el8.noarch
perl-libs-4:5.26.3-420.el8.x86_64
perl-macros-4:5.26.3-420.el8.x86_64
perl-parent-1:0.237-1.el8.noarch
perl-podlators-4.11-1.el8.noarch
perl-threads-1:2.21-2.el8.x86_64
perl-threads-shared-1.58-2.el8.x86_64
policycoreutils-python-utils-2.9-16.el8.noarch
protobuf-lite-3.5.0-13.el8.x86_64
Complete!

サービスの状態を確認します。
まだサービスはスタートしていない状態。

 command
[hogehoge@xxx-xxx-xxx-xxx ~]$ sudo systemctl status mysqld
[sudo] password for hogehoge:
● mysqld.service - MySQL 8.0 database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor pre>
Active: inactive (dead)

 

以下のコマンドでmysqlサービスをスタートします。

 command
[hogehoge@xxx-xxx-xxx-xxx ~]$ sudo systemctl start mysqld

確認すると、以下のようにactive状態になりました。

 command
[hogehoge@xxx-xxx-xxx-xxx ~]$ sudo systemctl status mysqld
● mysqld.service - MySQL 8.0 database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor pre>
Active: active (running) since Sun 2022-02-13 20:42:41 JST; 4s ago
Process: 27609 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, s>
Process: 27481 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service >
Process: 27457 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, sta>
Main PID: 27563 (mysqld)
Status: "Server is operational"
Tasks: 38 (limit: 4957)
Memory: 444.8M
CGroup: /system.slice/mysqld.service
mq27563 /usr/libexec/mysqld --basedir=/usr
Feb 13 20:42:29 xxx-xxx-xxx-xxx systemd[1]: Starting MySQL 8.0 database server...
Feb 13 20:42:30 xxx-xxx-xxx-xxx mysql-prepare-db-dir[27481]: Initializing MySQL da>
Feb 13 20:42:41 xxx-xxx-xxx-xxx systemd[1]: Started MySQL 8.0 database server.

常にmysqlサービスを起動するよう設定します。

 command
[hogehoge@xxx-xxx-xxx-xxx ~]$ sudo systemctl enable mysqld
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.

次にセキュリティの設定をします。

 command
[hogehoge@xxx-xxx-xxx-xxx ~]$ 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
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1
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!

MySQLにログインしてみます。

 command
[hogehoge@xxx-xxx-xxx-xxx ~]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.02 sec)
mysql> quit
Bye

-ConohaVPS
-ConohaVPS, MySQL

© 2024 プログラマの雑記帳 Powered by AFFINGER5