리눅스 서버 사용자(계정) 생성 + mysql(db) 만들기
2010. 6. 5. 17:43ㆍ개발/리눅스
반응형
1. 사용자 계정 생성 - putty 로 접속 후 "adduser 계정이름" 실행
playi@playi:~$ sudo adduser gayu
Adding user `gayu' ...
Adding new group `gayu' (1008) ...
Adding new user `gayu' (1008) with group `gayu' ...
Creating home directory `/home/gayu' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for gayu
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] y
Adding user `gayu' ...
Adding new group `gayu' (1008) ...
Adding new user `gayu' (1008) with group `gayu' ...
Creating home directory `/home/gayu' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for gayu
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] y
adduser 계정이름 를 입력하시고 엔터키 누르면 패스워드 입력부분이 나옵니다.
비번 입력후 기타정보를 입력하는 부분이 나오는데 입력안해도 상관없습니다.
* 저같은 경우는 우분투서버이기 때문에 앞에 sudo 를 붙였습니다.
실행 후 /home 디렉토리에서 ls -l 을 실행하시면 해당계정이름의 디렉토리가 생성된것을 보실 수 있습니다.
2. mysql 생성하기 : mysql -u root -p 로 mysql에 접속합니다.
playi@playi:/home$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1053
Server version: 5.0.67-0ubuntu6.1 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
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> create database 계정이름;
Query OK, 1 row affected (0.01 sec)
mysql> Grant ALL ON 계정이름 TO gayu@localhost IDENTIFIED BY '비밀번호';
Query OK, 0 rows affected (0.00 sec)
mysql> insert into db values('%','생성할디비이름','계정이름','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> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1053
Server version: 5.0.67-0ubuntu6.1 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
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> create database 계정이름;
Query OK, 1 row affected (0.01 sec)
mysql> Grant ALL ON 계정이름 TO gayu@localhost IDENTIFIED BY '비밀번호';
Query OK, 0 rows affected (0.00 sec)
mysql> insert into db values('%','생성할디비이름','계정이름','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> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> use mysql;
--> mysql 이라는 db를 사용한다는 뜻입니다. mysql db 안에 user 테이블이 있답니다.
mysql> create database 계정이름;
--> 사용자 계정이름으로 데이타베이스를 생성합니다.
mysql> Grant ALL ON 계정이름 TO gayu@localhost IDENTIFIED BY '비밀번호';
--> 계정이름에 비밀번호를 부여합니다.
--> grant all on 은 이 계정사용자만의 독립적인 권한을 부여하는 의미라고 보시면 됩니다.
mysql> insert into db values('%','생성할디비이름','계정이름 ','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
--> 생성할 db의 필드값을 입력합니다.
--> y컬럼 갯수확인은 desc db; 하시면 확인가능합니다. 저같은 경우는 Y옵션이 17개입니다.
mysql> flush privileges;
--> 등록한 계정과 db를 적용시켜줍니다.
######### 위에까지 하면 해당 계정의 database가 생성됩니다. ############
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| gayu |
| mysql |
| playi |
+--------------------+
11 rows in set (0.00 sec)
+--------------------+
| Database |
+--------------------+
| information_schema |
| gayu |
| mysql |
| playi |
+--------------------+
11 rows in set (0.00 sec)
show databases; 하시면 생성된 데이타베이스를 확인하실 수 있습니다.
반응형
'개발 > 리눅스' 카테고리의 다른 글
슥훌(phps.kr) 가상서버호스팅 구입 후 세팅 (0) | 2016.06.22 |
---|---|
서버설치 - 서버랙 대신 방음재로 소음차단했습니다. (4) | 2010.06.03 |
홈페이지 계정&데이타베이스 백업+복구하기~! (0) | 2010.03.13 |
[서버보안] SYN Flooding(신플루딩) 공격 막기 (3) | 2010.02.23 |
리눅스 시스템 정보 및 상태 알아보기 (2) | 2010.02.20 |