LoginSignup
2
0

More than 5 years have passed since last update.

MySQL8.0のtemporary passwordについて

Posted at

超小ネタ。いつか忘れると思ったのでメモ。

MySQL5.7以降はMySQLのインストール後/var/log/mysqld.logにrootのtemporary passwordが出力されます。
5.7だとこんな感じ。

2018-12-01T00:00:00.000000Z 1 [Note] A temporary password is generated for root@localhost: xxxxxxxxxxxx

MySQL8.0では以下のようになりました。

2018-12-01T00:00:00.000000Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: xxxxxxxxxxxx

2単語増えました。なのでawkでパスワードだけ抜き出す場合は5.7だと

cat /var/log/mysqld.log | grep 'temporary password' | awk '{print $11}'

でしたが、8.0では

cat /var/log/mysqld.log | grep 'temporary password' | awk '{print $13}'

になりました。
Ansibleのymlとかに埋めてる場合は注意が必要です。

2
0
1

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
2
0