2015년 6월 2일 화요일

MySQL grant user 생성 및 권한 설정 (2007)

(2007/05/17 20:39 작성)

출처: http://blog.naver.com/tyboss/70013561894


1. 사용자 생성
GRANT USAGE ON *.* TO 사용자ID@접속호스트 IDENTIFIED BY "패스워드"
or
GRANT USAGE ON *.* TO zboard@localhost IDENTIFIED BY "password"
or
GRANT USAGE ON *.* TO zboard@% IDENTIFIED BY "password"

2. 권한 부여
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON 디비이름 TO 사용자ID@접속호스트
or
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON zboard.* TO zboard@localhost
or
GRANT ALL PRIVILEGES ON *.* TO zboard@% : 모든권한주면서 외부접속


3. 권한 로드
FLUSH PRIVILEGES
C:\>cd APM_Setup\Server\MySQL\bin
C:\APM_Setup\Server\MySQL\bin>mysql.exe -uroot -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 4.0.15-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE DATABASE IF NOT EXISTS zboard;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT USAGE ON *.* TO zboard@localhost IDENTIFIED BY "password";
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON zboard.* TO zboard@localhost;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

C:\APM_Setup\Server\MySQL\bin>mysql.exe -uzboard -p zboard
Enter password: ********

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17 to server version: 4.0.15-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> exit
Bye
C:\APM_Setup\Server\MySQL\bin>

댓글 없음:

댓글 쓰기