mysql 계정 생성 및 권한 부여
use mysql;
select user, host from user; //유저 정보 확인
create user 'id'@'localhost' identified by 'password'; //로컬 접속 유저
create user 'id'@'%' identified by 'password'; //모든ip 허용 유저
create user 'id'@'ip주소' identified by 'password'; //특정ip 허용 유저
drop user 'id'@'%'; //유저 삭제
grant all privileges on *.* to 'id'@'%'; //유저에게 모든db 권한 부여
grant all privileges on db명.* to 'id'@'%'; //유저에게 특정db 권한 부여
flush privileges; //권한 적용
권한 부여 에러가 날 시
GRANT ALL PRIVILEGES ON db명.* TO 'id'@'%' WITH GRANT OPTION; 로 확인
show grants for 'id'@'%'; //해당 유저의 권한 확인
revoke all privileges on db명.* from 'id'@'%'; //유저의 특정db 권한 삭제
grant select on db명.* to 'id'@'%'; // 유저에게 해당 DB select 권한 부여
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password'; //8.0 에러날 시