/root/.mysql_secret
に書かれている。
[root@hostname ~]# cat /root/.mysql_secret
# The random password set for the root user at Mon Jul 20 16:33:13 2020 (local time):
g1R3DBjSLM6f3pec
[root@hostname~]# mysql -uroot -pg1R3DBjSLM6f3pec
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.6.47
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> show databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
新しいパスワードをセットしないと怒られる。
mysql> set password for root@localhost=password("root");
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)