LoginSignup
3
9

More than 1 year has passed since last update.

CentOS 8にMySQL 8.0をインストール(AppStream)

Last updated at Posted at 2019-09-26

はじめに

Application Stream(AppStream)を利用してCentOS8にMySQL8.0をインストール
親記事:MySQL, MariaDBの各種インストール方法とEOLまとめ - Qiita
参考:RHEL8のパッケージ構成 - BaseOSとApplication Stream - 赤帽エンジニアブログ

サポート

本手法で導入した場合、Red Hat Enterprise Linux 8 Application Streams Life Cycle - Red Hat Customer Portalより、2023-04がEOLだと思われる。
それ以降に報告された脆弱性や不具合への対応は実施されない可能性がある。
なおCentOS Linux 8が2021-12にEOLを迎えるため、それ以降の更新を受けるためにはCentOS Stream8を含めた他ディストリビューションへの移行が必要。

LOG

インストール

# cat /etc/redhat-release
CentOS Linux release 8.0.1905 (Core)

# yum install -y @mysql:8.0
... 略

mysql起動/停止

# systemctl start mysqld
# systemctl status mysqld
● mysqld.service - MySQL 8.0 database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2019-09-26 07:53:41 EDT; 13s ago
  Process: 2222 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
  Process: 2098 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
  Process: 2073 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
 Main PID: 2180 (mysqld)
   Status: "SERVER_OPERATING"
    Tasks: 38 (limit: 11109)
   Memory: 487.8M
   CGroup: /system.slice/mysqld.service
           mq2180 /usr/libexec/mysqld --basedir=/usr

Sep 26 07:53:24 localhost.localdomain systemd[1]: Starting MySQL 8.0 database server...
Sep 26 07:53:24 localhost.localdomain mysql-prepare-db-dir[2098]: Initializing MySQL database
Sep 26 07:53:41 localhost.localdomain systemd[1]: Started MySQL 8.0 database server.
# systemctl stop mysqld
# systemctl status mysqld
● mysqld.service - MySQL 8.0 database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

Sep 26 07:53:24 localhost.localdomain systemd[1]: Starting MySQL 8.0 database server...
Sep 26 07:53:24 localhost.localdomain mysql-prepare-db-dir[2098]: Initializing MySQL database
Sep 26 07:53:41 localhost.localdomain systemd[1]: Started MySQL 8.0 database server.
Sep 26 07:54:25 localhost.localdomain systemd[1]: Stopping MySQL 8.0 database server...
Sep 26 07:54:27 localhost.localdomain systemd[1]: Stopped MySQL 8.0 database server.

mysql自動起動設定/設定解除

# systemctl enable mysqld
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.

# systemctl list-unit-files --type=service |grep mysql
mysqld.service                              enabled
mysqld@.service                             disabled
# systemctl disable mysqld
Removed /etc/systemd/system/multi-user.target.wants/mysqld.service.

# systemctl list-unit-files --type=service |grep mysql
mysqld.service                              disabled
mysqld@.service                             disabled

各種確認

# which mysql
/usr/bin/mysql

# which mysqld
/usr/sbin/mysqld

# systemctl start mysqld
# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.13 Source distribution

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

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.13    |
+-----------+
1 row in set (0.00 sec)
3
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
9