🔒 mysql 비밀번호 재설정

❌ 오류

mysql에서 옳은 비밀번호를 입력했음에도 불구하고

(28000): Access denied for user ‘root’@‘localhost’ (using password: YES)

오류를 마주했다.

mysql 비밀번호 맞는데 되지 않는 상황이다.

mysql> UPDATE user set password=password(“1234”) where user = ‘root’;

로 비밀번호 초기화를 시도했지만 아래와 같이 반환되었다.

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’(“1234”) where user = ‘root” at line 1

🙆‍♂️ 해결

mysql은 버전에 따라 옳은 커맨드를 입력해도 구문 오류가 반환될 수 있기 때문이다.

계속해서 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’(“1234”) where user = ‘root” at line 1 오류가 반복된다면 mysql 버전에 맞는 커맨드로 mysql root 패스워드 변경을 진행한다.

mysql -u root -p

password 입력하지 않고 엔터

alter user 'root'@'localhost' identified with mysql_native_password by 'my_new_password';
flush privileges;

반드시 flush privileges; 까지 입력해주지 않으면 로그인이 불가능해진다.

error 1045 (28000): access denied for user ‘root’@‘localhost’ (using password: yes) error 1045 (28000): access denied for user ‘root’@‘localhost’ (using password: no) error 1045 (28000): access denied for user access denied for user ‘root’@‘localhost’ (using password: yes) error 1045 (28000): access denied for user ‘root’@‘localhost’ access denied for user ‘root’@‘localhost’ (using password yes) error 1045 access denied for user ‘root’@‘localhost’ (using password yes) access denied for user ‘root’@‘localhost’ (using password: no) error 1045 mysql 28000 access denied for user ‘root’@‘localhost’ 등 수많은 오류로 이 게시물을 찾았다면 버전 확인이 먼저여야 한다.