상세 컨텐츠

본문 제목

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

mysql

by 2hansoul 2021. 6. 16. 19:35

본문

반응형

Using password :no 비번을 입력을 안했다는 건데 yes 뜨면 조금 다르다

sudo mysql -u root -p 입력하고 비번 입력창이 뜰 탠데 

1234 를 해보거나 아니면 그냥 비번을 입력하지 않고 엔터를 눌러서 접속 한다

 

접속이 되면 비밀번호 재설정을 해주면 된다

mysql> use mysql;

mysql> UPDATE user set password=password("1234") where user = 'root';

Query OK, 1 row affected (0.02 sec)

Rows matched: 4  Changed: 4  Warnings: 0

mysql> flush privileges;

 

ERROR 1356 (HY000): View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

이런 오류가 뜨면 밑에 처럼 바꿔서 진행하면 된다 10.5버전부터는 바껴서 그렇다

 

MariaDB [mysql]> set password for 'root'@'localhost' = password('1234');
Query OK, 0 rows affected (0.016 sec)
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.001 sec)

 

위에 방법 다 시도 해봤는데 적용이 안된다 왜 그런지는 잘 모르겠는데 alter로 그냥 바꿔봤더니 적용이 된다 

ALTER USER 'root'@'localhost' IDENTIFIED BY '1234';

 

위와 같이 입력하면, 비번이 1234로 설정된다.

참고로, flush privileges; 를 하지 않으면 mysql에서 빠져나와서 root 로그인이 안된다.




 

반응형

관련글 더보기

댓글 영역