MySQL 8.0 は root のパスワードをランダムに作成します

MySQL 8.0 では、安全のためインストールする毎にrootのパスワードをランダムな文字列で自動的に作成します。

MySQL 8.0をインストールすると、次のようなメッセージが表示されます。(以下はMacPortsでの例)

mysql8-server has the following notes:
If this is a new install you might want to run:

$ sudo /opt/local/lib/mysql8/bin/mysqld --initialize --user=_mysql
$ sudo port load mysql8-server
$ /opt/local/lib/mysql8/bin/mysql_secure_installation

The first command creates the necessary files for the MySQL database service.
(Remember to make a note of the auto-generated root password from this step.)
The second command starts the MySQL service.
The last command helps to improve the security of your running MySQL instance.

Once enabled, the MySQL logs can be found in:
/opt/local/var/log/mysql8

上記には、最初に実行する3つのコマンドが指示されています。最初に実行するのは以下のコマンドです。

sudo /opt/local/lib/mysql8/bin/mysqld --initialize --user=_mysql

上記のコマンドを実行すると、以下のような実行結果になります。赤矢印の箇所にrootのパスワードが作成されています。

この記事について

このページは、CEOが2025年12月29日 23:26に書いた記事です。

ひとつ前の記事は「FreeBSDに無線LANの設定を手作業で追加する方法」です。

次の記事は「FreeBSD で Puppeteer」です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。