0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[MySQL5.6] rootユーザーの初期パスワード確認方法

Last updated at Posted at 2020-07-21

/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)
0
0
0

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?