Programming &/Database
Mysql Grant 명령을 이용한 User 생성 및 권한 설정
마법눈
2009. 7. 5. 16:20
1. 데이터베이스 생성
CREATE DATABASE IF NOT EXISTS [DB];
2. 유저 생성
CREATE DATABASE IF NOT EXISTS [DB];
2. 유저 생성
- 지정된 DB에 권한을 지정하여 부여할 경우
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON [DB].* TO [USER]@localhost IDENTIFIED BY "[PASSWD]";
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON [DB].* TO [USER]@localhost IDENTIFIED BY "[PASSWD]";
- 지정된 DB에 모든 권한을 줄경우
GRANT ALL PRIVILEGES ON [DB].* TO [USER]@localhost IDENTIFIED BY "[PASSWD]";
- 특정 계정에 권한을 부여할경우
GRANT USAGE ON *.* TO [USER]@localhost IDENTIFIED BY "[PASSWD]"
GRANT USAGE ON *.* TO [USER]@localhost IDENTIFIED BY "[PASSWD]"
- root 계정과 동일한 권한을 부여할경우
GRANT ALL PRIVILEGES ON *.* TO [USER]@localhost IDENTIFIED BY "[PASSWD]";
3. 적용
FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON *.* TO [USER]@localhost IDENTIFIED BY "[PASSWD]";
3. 적용
FLUSH PRIVILEGES;