코드 한 줄

[Error] MySQL ERROR 1045 (28000) 본문

Develop -/MySQL

[Error] MySQL ERROR 1045 (28000)

Ahntenna 2018. 1. 8. 19:42


사용자 환경 : macOS Sierra 10.12.65.7.20 MySQL Community Server (GPL)





MySQL에 접속을 시도하다 보면 다음과 같은 에러문을 쉽게 볼 수 있을 것이다.

$> /usr/local/mysql/bin/mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
$> /usr/local/mysql/bin/mysql -uroot -p잘못된비밀번호
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
위에 두 에러의 차이점을 보자면, 마지막 단어인 using password: 부분이 각각 YES, NO로 되어있다.



그럼 두 에러를 하나씩 살펴보자.



$> /usr/local/mysql/bin/mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
위 에러는 비밀번호를 입력하지 않았을 경우 나타는 에러이다.
-p 옵션을 사용하여 옳바른 비밀번호를 입력하면 된다.



$> /usr/local/mysql/bin/mysql -uroot -p잘못된비밀번호
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

위 에러는 -p 옵션을 사용하여 비밀번호를 입력했지만, 옳바르지 않은 비밀번호를 입력했을 경우 나타는 에러이다.

옳바른 비밀번호를 입력 시 다음과 같은 화면이 출력된다.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.20 MySQL Community Server (GPL)

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>


Comments