1. 2007.08.22 DB사용자 등록 및 삭제

DB사용자 등록 및 삭제

--------등록--------------------------------------------------------------------
[root@localhost /root]# mysql -p mysql (root비번설정하지 않았을땐 -p제외)
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is xxxx to server version: 3.23.32-log

Type 'help' for help.

//사용자를 등록. 접속권한만! 나머지는 N으로 합니다.
mysql> insert into user values ('localhost','user',password('passwd'),
           'N','N','N','N','N','N','N','N','N','N','N','N','N','N');

Query OK, 1 row affected (0.00 sec)

// DB 권한을 줍니다.
mysql> insert into db values('localhost','DBname','user',
           'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');

version: 5.0.22
//사용자를 등록. 접속권한만! 나머지는 N으로 합니다.
mysql>insert into user values('localhost','user',password('passwd'),
          'N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N',
          'N','N','N','N','N','N','N','N','N','N','N','N','N','N');

// DB 권한을 줍니다.
mysql> insert into db values('localhost','DBname','user',
           'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');

Query OK, 1 row affected (0.00 sec)

mysql> \q
Bye

// DB생성
[root@localhost /root]# /usr/local/mysql/bin/mysqladmin -p create DBname
Database "DBname" created.

// 서버재시작
[root@localhost /root]# /usr/local/mysql/bin/mysqladmin reload 또는
[root@localhost /root]# mysql.server stop
[root@localhost /root]# mysql.server start
--------------------------------------------------------------------------------


---------삭제-------------------------------------------------------------------
mysqladmin -p drop DBname

[root@localhost /bin] ./mysql -p mysql
password : xxxxx
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is xxxx to server version: 3.23.32-log

Type 'help' for help.

mysql> delete from user where user='user';
mysql> delete from db where user='user';
mysql> \q

Return top