mysql workbench 에서 테이블을 확인하려고 백엔드 서버를 npm run dev 를 실행하였을 때, 오류가 발생하였다. 되던게 왜 갑자기 안될까 하다가, 문득 저번에 우분투에서 발생한 오류 고치려다가 되려 애먼 내 맥북의 mysql plugin 을 초기화 했던 기억이 났다. 물론 이것때문인지는 잘 모르겠다만, 조작한 게 이것뿐이니 아마 이것때문이 아닐 까 싶었다.
무엇이 되었던 오류 메세지를 잘 살펴보자
일단은 오류메세지를 살펴보니 mysql.infoschema@localhost 로 정의된(지정된) 사용자가 존재하지 않는다는 말이었다. 사용자가 존재하지 않는것이니 우선 mysql 에서 user 를 살펴보아야 할 것 같다.
mysql 을 실행하고
use mysql
select user, host from user;
이렇게 입력해주면,
이상하게도 mysql.infoschema 는 존재하였다. 없다면 생성해주면 될 것이라 생각했는데, 있으니 이해가 잘 되진 않았다. 스택오버플로우에서 비슷한 문제를 겪는 사람의 사례를 봤을 때, 권한을 주면 된다고 하여서 권한을 주려고
GRANT ALL PRIVILEGES ON *.*TO'mysql.infoschema'@'localhost' WITH GRANT OPTION;
이렇게 입력하니, 나는 유저에게 권한을 주는 것이 허용되지 않았다는 오류가 발생하였다. 구글링을 하니 해결방법들은 나오는데
'CREATE USER 'root'@'%' IDENTIFIED BY 'root'; 을 적용하면 root 권한을 가진 유저를 만드는 것이라 외부 노출 된 db 면 상당히 위험하다고 한다. 그렇기 때문에 어떻게 해야하나 싶다가 한번 다시 지우고 만들어보자 해서
delete from user where user='mysql.infoschema';
flush privileges;
mysql.infoschema 를 지워주고, 다시 만들어 주었다.
create user 'mysql.infoschema'@'localhost' identified by '비밀번호';
이렇게 다시 만든다음 위 권한을 주었다니 성공적으로 작동하였다. (Query OK)
이후 설정 저장후, 다시 mysql 에 접속한 뒤, mysql workbench 에서 접속하니 잘 접속이 되었다.
요새 대부분의 오류는 리엑트를 다룰 때 서버단에서 데이터를 알맞게 가져오지 못하여 렌더링 문제가 발생한다던지, 아니면 mysql 설정 시 발생하는 오류가 대부분인것 같다. 의도치 않게 mysql 을 공부하게 되는데, 거의 모르는 상태나 다름없으니 추후 시간을 잡아서 mysql 을 제대로 공부해보는 것도 좋을 것 같다. 또한 리눅스에 대한 지식도 같이 쌓아야겠다 생각이 든다.
'Programing > Error' 카테고리의 다른 글
Nginx 413 Request Entity Too Large (0) | 2023.04.30 |
---|---|
최후의 수단! Mysql 을 완전 삭제 후 재설치 과정 (0) | 2023.03.03 |
[ERROR]MySql root 비밀번호 설정 시 에러 (0) | 2023.01.05 |
Error : MySQL Sequelize 사용 중 Models 관련 오류 (0) | 2022.11.23 |
Error : Access denied for user '유저아이디'@'localhost' (using password: YES) 해결 및 mysql 비밀번호 초기화 (0) | 2022.11.16 |