Intellij와 mysql 연동시 (user 조회)

hyunwoo·2023년 2월 2일
0

Mysql

목록 보기
6/9

DB에 root user 말고 새로운 user를 생성하였다.
그래서 제대로 새로운 user가 생성이 되었는지 확인하는 과정에서 아래와 같은 코드를 작성했을 시 버전에 맞지 않는 문법이라고 에러가 났다.

select 'user' from 'mysql'.'user';

<에러>

[42000][1064] 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 ''mysql'.'user'' at line 1


select user from mysql.user;

구글링으로 위 코드를 작성하면
아래 이미지와 같이 user가 제대로 조회되는 것을 볼 수 있다.

show grants for 'stephenyi'@'local host';  // 현재 권한을 확인

grant all on board.* to 'stephenyi'@'local host' with grant option;  

// stephenyi 계정으로 로그인한 상태에서 다른 계정에게도 동일한 범위(board 데이터베이스)에
한해서 권한을 넣고 뺄 수 있다.

<권한 테이블 이미지>

0개의 댓글