mysql 에 root 로 접속
mysql> show databases; ---> 만들어져있는 db 들을 보여줌
mysql> create database delta; ----> delta 라는 이름으로 db 생성
mysql> use mysql  --->  mysql 이라는 이름의 db에 접속함 (mysql db 는 mysql 에서의 관리자라고 보면됨 왼같정보가 다있음)
mysql> select host,user,select_priv,insert_priv, update_priv,delete_priv from user;
[root@fedy bin]# ./mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 35
Server version: 5.1.48 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
+--------------------+
2 rows in set (0.00 sec)
mysql> create database delta;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| delta              |
| mysql              |
+--------------------+
3 rows in set (0.00 sec)
mysql>
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select host,user,select_priv,insert_priv, update_priv,delete_priv from user;
+-----------+------+-------------+-------------+-------------+-------------+
| host      | user | select_priv | insert_priv | update_priv | delete_priv |
+-----------+------+-------------+-------------+-------------+-------------+
| localhost | root | Y           | Y           | Y           | Y           |
| fedy      | root | Y           | Y           | Y           | Y           |
| 127.0.0.1 | root | Y           | Y           | Y           | Y           |
| localhost |      | N           | N           | N           | N           |
| fedy      |      | N           | N           | N           | N           |
| localhost | kim  | N           | N           | N           | N           |
| %         | kim  | Y           | Y           | Y           | Y           |
| %         | test | Y           | Y           | Y           | Y           |
| localhost | test | Y           | Y           | Y           | Y           |
+-----------+------+-------------+-------------+-------------+-------------+
9 rows in set (0.00 sec)
mysql>
 
[root@fedy bin]# ./mysql -u root -p ----> mysql 을 루트로 실행
mysql> use mysql   ---> mysql 이라는 이름의 db에 접속
mysql> show databases;   ---> mysql 에 만들어져있는 모든 db 를 보여줌
mysql> create database delta_project;   ---> delta_project 라는 이름의 db를 만듬
[root@fedy bin]# ./mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 45
Server version: 5.1.48 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
+--------------------+
2 rows in set (0.00 sec)
mysql> create database delta_project;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| delta_project      |
| mysql              |
+--------------------+
3 rows in set (0.00 sec)
mysql> select host,user,select_priv,insert_priv, update_priv,delete_priv from user;   ---> 사용자계정들의 정보
mysql> GRANT ALL PRIVILEGES ON delta_project.* to delta@localhost IDENTIFIED BY 'delta' with grant option;  
  --->  delta_project 라는 이름의 db 에 대해서 delta 라는 계정을 만듬... 권한은 모든 권한! (쓰고 지우고          업데이트하고 검색하고 등등), 로컬에서 접속할수있는 권한임 (@localhost 부분)
mysql> flush privileges; ---> 권한변경이 있을때 db를 내렸다 올려야적용이 되는데 이 명령으로 업뎃이 됨 안내려도됨
mysql> GRANT ALL PRIVILEGES ON delta_project.* to delta@"%" IDENTIFIED BY 'delta' with grant option
---> delta_project 라는 이름의 db 에 대해서 delta 라는 계정을 만드는데... 모든권한, 어디서 접속하든 다 허용 (@"%" 부분, 외부에서 툴을 가지고 접속할 수 있음)
mysql> select host,user,select_priv,insert_priv, update_priv,delete_priv from user;
+-----------+------+-------------+-------------+-------------+-------------+
| host      | user | select_priv | insert_priv | update_priv | delete_priv |
+-----------+------+-------------+-------------+-------------+-------------+
| localhost | root | Y           | Y           | Y           | Y           |
| fedy      | root | Y           | Y           | Y           | Y           |
| 127.0.0.1 | root | Y           | Y           | Y           | Y           |
| localhost |      | N           | N           | N           | N           |
| fedy      |      | N           | N           | N           | N           |
+-----------+------+-------------+-------------+-------------+-------------+
5 rows in set (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON delta_project.* to delta@localhost IDENTIFIED BY 'delta' with grant option;
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user,select_priv,insert_priv, update_priv,delete_priv from user;
+-----------+-------+-------------+-------------+-------------+-------------+
| host      | user  | select_priv | insert_priv | update_priv | delete_priv |
+-----------+-------+-------------+-------------+-------------+-------------+
| localhost | root  | Y           | Y           | Y           | Y           |
| fedy      | root  | Y           | Y           | Y           | Y           |
| 127.0.0.1 | root  | Y           | Y           | Y           | Y           |
| localhost |       | N           | N           | N           | N           |
| fedy      |       | N           | N           | N           | N           |
| localhost | delta | N           | N           | N           | N           |
+-----------+-------+-------------+-------------+-------------+-------------+
6 rows in set (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON delta_project.* to delta@"%" IDENTIFIED BY 'delta' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user,select_priv,insert_priv, update_priv,delete_priv from user;
+-----------+-------+-------------+-------------+-------------+-------------+
| host      | user  | select_priv | insert_priv | update_priv | delete_priv |
+-----------+-------+-------------+-------------+-------------+-------------+
| localhost | root  | Y           | Y           | Y           | Y           |
| fedy      | root  | Y           | Y           | Y           | Y           |
| 127.0.0.1 | root  | Y           | Y           | Y           | Y           |
| localhost |       | N           | N           | N           | N           |
| fedy      |       | N           | N           | N           | N           |
| %         | delta | N           | N           | N           | N           |
| localhost | delta | N           | N           | N           | N           |
+-----------+-------+-------------+-------------+-------------+-------------+
7 rows in set (0.00 sec)
mysql>
야매로 썼음... 절대로 신뢰하지 말것!
*참고*
db 생성 : >create database 가나다;
db 삭제 : >drop database 가나다;
table 생성 : >create table 가나다;
table 삭제 : >drop table 가나다;



* 추가

GRANT ALL PRIVILEGES ON 데이터베이스명.* to 사용자계정@localhost IDENTIFIED BY '암호' with grant option;
07 16, 2010 18:01 07 16, 2010 18:01
iamback 이 작성.

Trackback URL : http://pippen80.cafe24.com/trackback/238

Trackback RSS : http://pippen80.cafe24.com/rss/trackback/238

Trackback ATOM : http://pippen80.cafe24.com/atom/trackback/238


« Prev : 1 : ... 46 : 47 : 48 : 49 : 50 : 51 : 52 : 53 : 54 : ... 251 : Next »