USER 정보를 생성, 삭제 및 권한 확인, 권한 부여하기 위한 SQL 문법입니다.
USER 정보는 mysql DB에서 관리된다.
USER의 username은 중복 생성이 불가하다.
(단, host 정보 - localhost, % 가 다르다면 중복 생성 가능하다.)
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
DROP USER 'username'@'localhost';
또는
DROP USER 'username'@'%';
SHOW GRANTS FOR 'username'@'localhost';
또는
SHOW GRANTS FOR 'username'@'%';
GRANT ALL ON DBname.* to 'username'@'localhost';
또는
GRANT ALL ON DBname.* to 'username'@'%';
REVOKE ALL ON DBname.* from 'username'@'localhost';
또는
REVOKE ALL ON DBname.* from 'username'@'%';
가정)
CREATE USER 'aiden'@'localhost' IDENTIFIED BY '1234';
CREATE USER 'aiden'@'%' IDENTIFIED BY '1234';
DROP USER 'aiden'@'localhost';
또는
DROP USER 'aiden'@'%';
SHOW GRANTS FOR 'aiden'@'localhost';
또는
SHOW GRANTS FOR 'aiden'@'%';
GRANT ALL ON testDB.* to 'aiden'@'localhost';
또는
GRANT ALL ON testDB.* to 'aiden'@'%';
REVOKE ALL ON testDB.* from 'aiden'@'localhost';
또는
REVOKE ALL ON testDB.* from 'aiden'@'%';