【MySQL】初心者必見!HomebrewでMySQLを コマンドでインストールする方法

2023年2月21日DataBase,MySQL

ミニマリスト_カミ

kamiです。
TwitterYoutubeもやってます。

今回はプログラミング初心者のみなさんに向けに、MySQLを「初心者向けにわかりやすくを心がけて」、記事を書いてます。
MySQLは難しそうに見えて、そうでもないですよ。
僕でもできたので、必ずみなさんも成し遂げれるのでぜひ最後まで読んで参考にしてみてくださいね!

今回は「Homebrew」を使ってMySQLインストールします。
Homebrewの使い方も合わせて覚えていきましょう。

MySQLとは

端的に説明するとMySQLは、
Oracleが開発したオープンソースの、SQLリレーショナルデータベース(RGB)管理システムです。
また以下がSQL操作でよく使われています。

一言で言とデータベースの一種です。

データベース・SQLの種類

icon

SQLとはDBを扱う用の言語だと思ってください。

SQLの種類はいくつかありますが、シェア率の意多い「Oracle」や「MySQL」などの学習をおすすめします。
実際に使うSQLは会社や案件ごとに異なってきますのが、基本は変わらないので一つ覚えておけば、たのSQLもすぐに学ぶことができます。

  • Oracle
  • MySQL
  • PostgreSQL
  • SQLite
    ※一部の紹介です

リレーショナルデータベース(RGB)

リレーショナルデータベース(RDB)とはRDBは列と行で構成されたデータベースのことです。
表計算であるエクセルなどのソフトを想像してもらえればイメージがつきやすいと思います。

スポンサードサーチ

データベースとは

データベースは、データを検索して簡単に取得して、使用したり上書きしたり、削除したり、データをまとめて構造化したものです。

みなさんが普段使用している、Webサイトやアプリの会員情報などはデータベースで基本管理されています。
またExcelなどのソフトと連携することができ、CSVデータのインポートやエクスポートをすることができます。

SQLからデータベースへ行える操作

SQLからデータベースにに行えることは次のことがあります。

  • データ追加
  • データ更新
  • データ削除
  • データ検索
  • テーブル作成
  • テーブル削除
  • テーブルの主キーの設定
  • ユーザー権限の付与

スポンサードサーチ

MySQLをインストール

MySQLをインストールをやりましょう。

MySQLのインストールにはHome Brewを使います。
ターミナルでコマンドを入力してください。

Homebrewのインストール

Homebrewのインストール紹介です。

ターミナルで次のコマンドを叩いてください。
※コマンドが変わることがあるので詳しくは、下記リンク参考にしてみてください。

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

パスワードを求められたらPCのパスワードを入力してください。

スポンサードサーチ

Homebrewのアップデート

Homebrewのアップデート

Homebrewのアップデートには「update」コマンドを叩きます。

// Homebrewのアップデート
MacBook-Pro:~ User$ brew update
// Homebrewのアップデート
MacBook-Pro:~ User$ brew update
Updated 1 tap (homebrew/core).
==> Updated Formulae
grafana         libdeflate      podman          semgrep         sonarqube

You have 5 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.

以下のコードが表示されれば、homebrewのアップデート完了です。

You have 5 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated.

Homebrew使ってインストール

次のコマンドで「Homebrew」「MySQL」をインストールします

// Homebrewを使ってインストール
$ brew install mysql

MySQLのインストールは時間がかかるので、少し待ちます

Last login: Tue Feb 21 20:04:36 on ttys000
kami@kami ~ % brew install mysql
Running `brew update --auto-update`...
==> Downloading https://formulae.brew.sh/api/formula.json
######################################################################## 100.0%
==> Downloading https://formulae.brew.sh/api/cask.json
######################################################################## 100.0%
==> Fetching dependencies for mysql: openssl@1.1, libevent, libcbor, libfido2, protobuf, zlib and zstd
==> Fetching openssl@1.1
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/manifests/1.1.1t
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/blobs/sha256:524ec0
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching libevent
==> Downloading https://ghcr.io/v2/homebrew/core/libevent/manifests/2.1.12
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libevent/blobs/sha256:4867e07fe
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching libcbor
==> Downloading https://ghcr.io/v2/homebrew/core/libcbor/manifests/0.10.2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libcbor/blobs/sha256:57f42308a7
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching libfido2
==> Downloading https://ghcr.io/v2/homebrew/core/libfido2/manifests/1.12.0_1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libfido2/blobs/sha256:fc615aa64
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching protobuf
==> Downloading https://ghcr.io/v2/homebrew/core/protobuf/manifests/21.12-1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/protobuf/blobs/sha256:fdc3ded19
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching zlib
==> Downloading https://ghcr.io/v2/homebrew/core/zlib/manifests/1.2.13
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/zlib/blobs/sha256:27b22a6738cbf
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching zstd
==> Downloading https://ghcr.io/v2/homebrew/core/zstd/manifests/1.5.4
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/zstd/blobs/sha256:6de68b55a5336
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching mysql
==> Downloading https://ghcr.io/v2/homebrew/core/mysql/manifests/8.0.32
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/mysql/blobs/sha256:6bcaa04f58dc
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Installing dependencies for mysql: openssl@1.1, libevent, libcbor, libfido2, protobuf, zlib and zstd
==> Installing mysql dependency: openssl@1.1
==> Pouring openssl@1.1--1.1.1t.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/openssl@1.1/1.1.1t: 8,101 files, 18MB
==> Installing mysql dependency: libevent
==> Pouring libevent--2.1.12.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libevent/2.1.12: 57 files, 2.1MB
==> Installing mysql dependency: libcbor
==> Pouring libcbor--0.10.2.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libcbor/0.10.2: 31 files, 193.7KB
==> Installing mysql dependency: libfido2
==> Pouring libfido2--1.12.0_1.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libfido2/1.12.0_1: 538 files, 1.3MB
==> Installing mysql dependency: protobuf
==> Pouring protobuf--21.12.arm64_monterey.bottle.1.tar.gz
🍺  /opt/homebrew/Cellar/protobuf/21.12: 285 files, 10.2MB
==> Installing mysql dependency: zlib
==> Pouring zlib--1.2.13.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/zlib/1.2.13: 13 files, 398.9KB
==> Installing mysql dependency: zstd
==> Pouring zstd--1.5.4.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/zstd/1.5.4: 31 files, 2.3MB
==> Installing mysql
==> Pouring mysql--8.0.32.arm64_monterey.bottle.tar.gz
==> /opt/homebrew/Cellar/mysql/8.0.32/bin/mysqld --initialize-insecure --user=ka
==> Caveats
We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -u root

To start mysql now and restart at login:
  brew services start mysql
==> Summary
🍺  /opt/homebrew/Cellar/mysql/8.0.32: 317 files, 298.2MB
==> Running `brew cleanup mysql`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Upgrading 5 dependents of upgraded formulae:
Disable this behaviour by setting HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
aom 3.5.0_1 -> 3.6.0, curl 7.87.0 -> 7.88.1, jpeg-xl 0.7.0_1 -> 0.8.1, php 8.2.1_1 -> 8.2.3, composer 2.5.1 -> 2.5.4
==> Fetching dependencies for curl: libnghttp2 and openldap
==> Fetching libnghttp2
==> Downloading https://ghcr.io/v2/homebrew/core/libnghttp2/manifests/1.52.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libnghttp2/blobs/sha256:947d901
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching openldap
==> Downloading https://ghcr.io/v2/homebrew/core/openldap/manifests/2.6.4
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openldap/blobs/sha256:a90061f15
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching curl
==> Downloading https://ghcr.io/v2/homebrew/core/curl/manifests/7.88.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/curl/blobs/sha256:2e798ccc19376
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching dependencies for jpeg-xl: highway, jpeg-turbo and little-cms2
==> Fetching highway
==> Downloading https://ghcr.io/v2/homebrew/core/highway/manifests/1.0.3
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/highway/blobs/sha256:d113ba1bce
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching jpeg-turbo
==> Downloading https://ghcr.io/v2/homebrew/core/jpeg-turbo/manifests/2.1.5.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/jpeg-turbo/blobs/sha256:844f7f6
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching little-cms2
==> Downloading https://ghcr.io/v2/homebrew/core/little-cms2/manifests/2.14
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/little-cms2/blobs/sha256:ae03cf
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching jpeg-xl
==> Downloading https://ghcr.io/v2/homebrew/core/jpeg-xl/manifests/0.8.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/jpeg-xl/blobs/sha256:f0fcfea7ac
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching aom
==> Downloading https://ghcr.io/v2/homebrew/core/aom/manifests/3.6.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/aom/blobs/sha256:82c42edfcd3aa2
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching dependencies for php: apr, apr-util, freetds, freetype, fontconfig and libpq
==> Fetching apr
==> Downloading https://ghcr.io/v2/homebrew/core/apr/manifests/1.7.2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/apr/blobs/sha256:933669452ddcd5
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching apr-util
==> Downloading https://ghcr.io/v2/homebrew/core/apr-util/manifests/1.6.3
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/apr-util/blobs/sha256:b9f49b64b
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching freetds
==> Downloading https://ghcr.io/v2/homebrew/core/freetds/manifests/1.3.17
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/freetds/blobs/sha256:0a3739275e
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching freetype
==> Downloading https://ghcr.io/v2/homebrew/core/freetype/manifests/2.13.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/freetype/blobs/sha256:d033f5606
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching fontconfig
==> Downloading https://ghcr.io/v2/homebrew/core/fontconfig/manifests/2.14.2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/fontconfig/blobs/sha256:2e1558c
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching libpq
==> Downloading https://ghcr.io/v2/homebrew/core/libpq/manifests/15.2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libpq/blobs/sha256:15e14f403696
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching php
==> Downloading https://ghcr.io/v2/homebrew/core/php/manifests/8.2.3
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/php/blobs/sha256:5b0e2af510e09f
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching composer
==> Downloading https://ghcr.io/v2/homebrew/core/composer/manifests/2.5.4
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/composer/blobs/sha256:2c7cf469b
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Upgrading curl
  7.87.0 -> 7.88.1 

==> Installing dependencies for curl: libnghttp2 and openldap
==> Installing curl dependency: libnghttp2
==> Pouring libnghttp2--1.52.0.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libnghttp2/1.52.0: 13 files, 731.6KB
==> Installing curl dependency: openldap
==> Pouring openldap--2.6.4.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/openldap/2.6.4: 340 files, 7.8MB
==> Installing curl
==> Pouring curl--7.88.1.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/curl/7.88.1: 510 files, 4.3MB
==> Running `brew cleanup curl`...
Removing: /opt/homebrew/Cellar/curl/7.87.0... (510 files, 4.3MB)
Removing: /Users/kami/Library/Caches/Homebrew/curl--7.87.0... (1.3MB)
==> Upgrading jpeg-xl
  0.7.0_1 -> 0.8.1 

==> Installing dependencies for jpeg-xl: highway, jpeg-turbo and little-cms2
==> Installing jpeg-xl dependency: highway
==> Pouring highway--1.0.3.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/highway/1.0.3: 61 files, 2.3MB
==> Installing jpeg-xl dependency: jpeg-turbo
==> Pouring jpeg-turbo--2.1.5.1.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/jpeg-turbo/2.1.5.1: 44 files, 2.5MB
==> Installing jpeg-xl dependency: little-cms2
==> Pouring little-cms2--2.14.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/little-cms2/2.14: 21 files, 1.4MB
==> Installing jpeg-xl
==> Pouring jpeg-xl--0.8.1.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/jpeg-xl/0.8.1: 41 files, 10.7MB
==> Running `brew cleanup jpeg-xl`...
Removing: /opt/homebrew/Cellar/jpeg-xl/0.7.0_1... (41 files, 9.9MB)
Removing: /Users/kami/Library/Caches/Homebrew/jpeg-xl--0.7.0_1... (4.0MB)
==> Upgrading aom
  3.5.0_1 -> 3.6.0 

==> Pouring aom--3.6.0.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/aom/3.6.0: 23 files, 8.7MB
==> Running `brew cleanup aom`...
Removing: /opt/homebrew/Cellar/aom/3.5.0_1... (23 files, 8.5MB)
Removing: /Users/kami/Library/Caches/Homebrew/aom--3.5.0_1... (3.5MB)
==> Upgrading php
  8.2.1_1 -> 8.2.3 

==> Installing dependencies for php: apr, apr-util, freetds, freetype, fontconfig and libpq
==> Installing php dependency: apr
==> Pouring apr--1.7.2.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/apr/1.7.2: 59 files, 1.4MB
==> Installing php dependency: apr-util
==> Pouring apr-util--1.6.3.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/apr-util/1.6.3: 54 files, 891.7KB
==> Installing php dependency: freetds
==> Pouring freetds--1.3.17.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/freetds/1.3.17: 1,262 files, 14MB
==> Installing php dependency: freetype
==> Pouring freetype--2.13.0.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/freetype/2.13.0: 67 files, 2.4MB
==> Installing php dependency: fontconfig
==> Pouring fontconfig--2.14.2.arm64_monterey.bottle.tar.gz
==> Regenerating font cache, this may take a while
==> /opt/homebrew/Cellar/fontconfig/2.14.2/bin/fc-cache -frv
🍺  /opt/homebrew/Cellar/fontconfig/2.14.2: 88 files, 2.4MB
==> Installing php dependency: libpq
==> Pouring libpq--15.2.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libpq/15.2: 2,368 files, 28.5MB
==> Installing php
==> Pouring php--8.2.3.arm64_monterey.bottle.tar.gz
==> /opt/homebrew/Cellar/php/8.2.3/bin/pear config-set php_ini /opt/homebrew/etc
==> /opt/homebrew/Cellar/php/8.2.3/bin/pear config-set php_dir /opt/homebrew/sha
==> /opt/homebrew/Cellar/php/8.2.3/bin/pear config-set doc_dir /opt/homebrew/sha
==> /opt/homebrew/Cellar/php/8.2.3/bin/pear config-set ext_dir /opt/homebrew/lib
==> /opt/homebrew/Cellar/php/8.2.3/bin/pear config-set bin_dir /opt/homebrew/opt
==> /opt/homebrew/Cellar/php/8.2.3/bin/pear config-set data_dir /opt/homebrew/sh
==> /opt/homebrew/Cellar/php/8.2.3/bin/pear config-set cfg_dir /opt/homebrew/sha
==> /opt/homebrew/Cellar/php/8.2.3/bin/pear config-set www_dir /opt/homebrew/sha
==> /opt/homebrew/Cellar/php/8.2.3/bin/pear config-set man_dir /opt/homebrew/sha
==> /opt/homebrew/Cellar/php/8.2.3/bin/pear config-set test_dir /opt/homebrew/sh
==> /opt/homebrew/Cellar/php/8.2.3/bin/pear config-set php_bin /opt/homebrew/opt
==> /opt/homebrew/Cellar/php/8.2.3/bin/pear update-channels
🍺  /opt/homebrew/Cellar/php/8.2.3: 519 files, 83.3MB
==> Running `brew cleanup php`...
Removing: /opt/homebrew/Cellar/php/8.2.1... (519 files, 83.3MB)
Removing: /opt/homebrew/Cellar/php/8.2.1_1... (519 files, 83.3MB)
Removing: /Users/kami/Library/Caches/Homebrew/php--8.2.1_1... (19.7MB)
Removing: /Users/kami/Library/Caches/Homebrew/php--8.2.1... (19.7MB)
==> Upgrading composer
  2.5.1 -> 2.5.4 

==> Pouring composer--2.5.4.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/composer/2.5.4: 3 files, 2.7MB
==> Running `brew cleanup composer`...
Removing: /opt/homebrew/Cellar/composer/2.5.1... (3 files, 2.7MB)
Removing: /Users/kami/Library/Caches/Homebrew/composer--2.5.1... (682.3KB)
==> Checking for dependents of upgraded formulae...
==> No broken dependents found!
==> `brew cleanup` has not been run in the last 30 days, running now...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /opt/homebrew/Cellar/apr/1.7.0_3... (59 files, 1.4MB)
Removing: /Users/kami/Library/Caches/Homebrew/apr--1.7.0_3... (389KB)
Removing: /opt/homebrew/Cellar/apr-util/1.6.1_4... (54 files, 889KB)
Removing: /Users/kami/Library/Caches/Homebrew/apr-util--1.6.1_4... (238.1KB)
Removing: /opt/homebrew/Cellar/ca-certificates/2022-10-11... (3 files, 225.5KB)
Removing: /Users/kami/Library/Caches/Homebrew/ca-certificates--2022-10-11... (127.5KB)
Removing: /opt/homebrew/Cellar/fontconfig/2.14.1... (88 files, 2.4MB)
Removing: /Users/kami/Library/Caches/Homebrew/fontconfig--2.14.1... (626.7KB)
Removing: /opt/homebrew/Cellar/freetds/1.3.16... (1,262 files, 14MB)
Removing: /Users/kami/Library/Caches/Homebrew/freetds--1.3.16... (2.8MB)
Removing: /opt/homebrew/Cellar/freetype/2.12.1... (67 files, 2.3MB)
Removing: /Users/kami/Library/Caches/Homebrew/freetype--2.12.1... (890.3KB)
Removing: /opt/homebrew/Cellar/highway/1.0.2... (61 files, 2.3MB)
Removing: /Users/kami/Library/Caches/Homebrew/highway--1.0.2... (420.2KB)
Removing: /opt/homebrew/Cellar/icu4c/71.1... (262 files, 76.8MB)
Removing: /Users/kami/Library/Caches/Homebrew/icu4c--71.1... (28.4MB)
Removing: /opt/homebrew/Cellar/jpeg-turbo/2.1.4... (44 files, 2.5MB)
Removing: /Users/kami/Library/Caches/Homebrew/jpeg-turbo--2.1.4... (825.9KB)
Removing: /opt/homebrew/Cellar/libnghttp2/1.51.0... (13 files, 738.0KB)
Removing: /Users/kami/Library/Caches/Homebrew/libnghttp2--1.51.0... (213.4KB)
Removing: /opt/homebrew/Cellar/libpq/15.1... (2,367 files, 28.4MB)
Removing: /Users/kami/Library/Caches/Homebrew/libpq--15.1... (6.4MB)
Removing: /opt/homebrew/Cellar/openldap/2.6.3... (340 files, 7.8MB)
Removing: /Users/kami/Library/Caches/Homebrew/openldap--2.6.3... (2.9MB)
Removing: /opt/homebrew/Cellar/openssl@1.1/1.1.1s... (8,101 files, 18MB)
Removing: /Users/kami/Library/Caches/Homebrew/openssl@1.1--1.1.1s... (5MB)
Removing: /opt/homebrew/Cellar/webp/1.2.4... (41 files, 2.2MB)
Removing: /Users/kami/Library/Caches/Homebrew/webp--1.2.4... (756.4KB)
Removing: /opt/homebrew/Cellar/xz/5.4.0... (95 files, 1.6MB)
Removing: /Users/kami/Library/Caches/Homebrew/xz--5.4.0... (493.2KB)
Removing: /opt/homebrew/Cellar/zstd/1.5.2... (31 files, 2.2MB)
Removing: /Users/kami/Library/Caches/Homebrew/zstd--1.5.2... (749.2KB)
Removing: /Users/kami/Library/Logs/Homebrew/libtiff... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/libtool... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/gmp... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/libidn2... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/libpng... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/freetype... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/argon2... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/rtmpdump... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/imath... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/libavif... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/libunistring... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/highway... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/apr-util... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/brotli... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/icu4c... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/composer... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/readline... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/aom... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/lz4... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/webp... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/sqlite... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/php... (12 files, 3.2KB)
Removing: /Users/kami/Library/Logs/Homebrew/xz... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/unixodbc... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/libnghttp2... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/openexr... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/fontconfig... (2.8KB)
Removing: /Users/kami/Library/Logs/Homebrew/curl... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/giflib... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/krb5... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/freetds... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/libvmaf... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/ca-certificates... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/gettext... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/libssh2... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/zstd... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/libsodium... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/apr... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/autoconf... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/libpq... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/aspell... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/tidy-html5... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/m4... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/oniguruma... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/gd... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/pcre2... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/openssl@1.1... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/jpeg-xl... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/libzip... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/openldap... (64B)
Removing: /Users/kami/Library/Logs/Homebrew/jpeg-turbo... (64B)
Pruned 0 symbolic links and 9 directories from /opt/homebrew
==> Caveats
==> mysql
We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -u root

To start mysql now and restart at login:
  brew services start mysql
kami@kami ~ % 

インストールできているかのチェック

インストールされたか、確認しましょう。

// homebrewのインストール確認
brew info mysql

「Homebrew」「MySQL」の処理が止まるまで、少し待ちましょう。

mysql: stable 8.0.25 (bottled)
Open source relational database management system

Conflicts with: mariadb (because mysql, mariadb, and percona install the same binaries) percona-server (because mysql, mariadb, and percona install the same binaries) /usr/local/Cellar/mysql/8.0.25_1 (300 files, 293.6MB) * Poured from bottle on 2021-07-11 at 16:12:50 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/mysql.rb License: GPL-2.0-only with Universal-FOSS-exception-1.0 ==> Dependencies Build: cmake ✘, pkg-config ✘ Required: icu4c ✔, libevent ✔, lz4 ✔, openssl@1.1 ✔, protobuf ✔, zstd ✔ ==> Caveats We've installed your MySQL database without a root password. To secure it run: mysql_secure_installation MySQL is configured to only allow connections from localhost by default To connect run: mysql -uroot To have launchd start mysql now and restart at login: brew services start mysql Or, if you don't want/need a background service you can just run: mysql.server start ==> Analytics install: 62,346 (30 days), 216,111 (90 days), 916,055 (365 days) install-on-request: 62,109 (30 days), 214,693 (90 days), 901,880 (365 days) build-error: 0 (30 days)

mysql: stable 8.0.25 (bottled)と表示されていれば
無事にインストールができていますね。

mysqlのバージョン

mysql --version

「brew info mysql」でもバージョン確認できますが、
簡易にmysqlのバージョンも確認することができます。