티스토리 뷰

___APM

[MySQL] MySQL 5.7 이후 버전 root 비밀번호 변경

변군 변군이글루 2020. 5. 19. 13:39

MySQL(5.7.19 이후 버전) 설치 후 아래와 같은 에러가 발생

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

아래 명령으로 패스워드를 변경

SET PASSWORD = PASSWORD('P@ssw0rd1!');

 

$ ./mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.19

Copyright (c) 2000, 2017, 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> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

mysql> SET PASSWORD = PASSWORD('P@ssw0rd1!');
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> select 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)

mysql> FLUSH privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql> exit
Bye

 

 

댓글
댓글쓰기 폼