Docker上のmysqlのrootのパスワードが不明でハマった件
調査内容
Dockerというか普通にmysqlのトラブルシューティングで探すと、「–initialize-insecure」の実施が必要。
https://qiita.com/park-jh/items/1e118580ae1deab70f99
logを確認すると、「–initialize-insecure」を実施しろと。
https://kitsune.blog/mysql-login
[root@7aa3fe2e9efc log]# grep password /var/log/mysql/mysqld.log
2021-01-11T19:01:10.555127Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
実施、再起動
[root@7aa3fe2e9efc log]# mysqld --initialize-insecure --user=mysql
[root@7aa3fe2e9efc log]# systemctl start mysqld
パスワードなしで入れた!
[root@7aa3fe2e9efc log]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.21 Source distribution
Copyright (c) 2000, 2020, 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>
mysql root のパスワード設定
https://webkaru.net/mysql/mysql-root-password/
$mysqladmin -u root password 'PASSWORD'