Databases
mysql grant user 생성 및 권한 설정
duraboys
2010. 4. 9. 11:13
1. 사용자 생성
GRANT USAGE ON *.* TO 사용자ID@접속호스트 IDENTIFIED BY "패스워드"
or
GRANT USAGE ON *.* TO zboard@localhost IDENTIFIED BY "password"
or
2. 권한 부여
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON
디비이름 TO 사용자ID@접속호스트
디비이름 TO 사용자ID@접속호스트
or
or
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>
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>