mysql - grant 구문
mysql> grant all on mysql.* to root@"%" identified by "1234"; // 전체 아이피에 허용해 줌.
mysql> grant all on mysql.* to root@"192.168.0.234" identified by "1234";
mysql> grant all on mysql.* to root@"www.escit.net" identified by "1234";
[GRANT 구문사용하기]
mysql> grant all on *.* to '아이디'@'localhost' identified by 'PASS';
mysql> grant all on DB.* to '아이디'@'localhost' identified by 'PASS';
mysql> grant select on DB.* to '아이디'@'localhost' identified by 'PASS';
mysql> grant update on DB.* to '아이디'@'localhost' identified by 'PASS';
mysql> grant select,update on DB.* to '아이디'@'localhost' identified by 'PASS';
mysql> flush privileges;
[Mysql 원격 접속 설정]
mysql> grant all on DB명.* to 아이디@접속아이피 identified by 'PASS';
mysql> grant all on DB명.* to 아이디@'%' identified by '패스워드'; // 전체 아이피
mysql> flush privileges;
[컬럼에 권한 설정]
mysql> GRANT SELECT (column_1), INSERT (column_1,column_2) ON DB.* TO 'someuser'@'localhost';
[root 변경]
mysql> update user set password = password('패스') where user='root';
[계정 삭제 설정]
mysql> drop user 아이디@localhost;
[grant 주요 privilege 옵션]
- SELECT,UPDATE,INSERT,DELETE,FILE
- ALTER,CREATE,INDEX,PROCESS,RELOAD,DROP,EXECUTE
[grant 기타 privilege 옵션]
- CREATE TEMPORARY TABLES
- LOCK TABLES,REPLICATION CLIENT
- REPLICATION SLAVE
- SHOW DATABASES
- SHUTDOWN
- SUPER
- GRANT OPTION
[출처] mysql 사용자 등록 및 권한 설정(grant)|작성자 정찬호