본문 바로가기
프로그래밍/DB

MySql] Root로그인, Root 암호 설정, DB만들기, 계정생성, 권한부여

by Super User 2009. 6. 10.

1. ROOT로그인
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 66 to server version: 4.0.18-standard

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

 

2. ROOT 암호 설정

mysql>use mysql;
mysql> update user set password=password('xxxxx') where user = 'root'

 

3. 데이터베이스만들기
mysql> create database db명;
Query OK, 1 row affected (0.00 sec)

 

4. 계정생성
mysql> GRANT USAGE ON *.* TO 아이디@localhost IDENTIFIED BY "비밀번호";
Query OK, 0 rows affected (0.00 sec)

 

5. 생성한데이터베이스에 사용권한 부여하기
mysql> use db명;
Database changed
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON db명.* TO 아이디@localhost;
Query OK, 0 rows affected (0.01 sec)

 

6. 외부접속 가능한 사용자 계정 만들기

GRANT USAGE ON *.* TO userID@localhost IDENTIFIED BY "password";

 

권한설정

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON DBname.* TO userid@'%';

 


'프로그래밍 > DB' 카테고리의 다른 글

mysql 프로시져 생성, 호출  (0) 2009.07.08
## MySQL root 패스워드 분실시  (0) 2009.06.18
Mysql DB 백업/ 복원  (0) 2009.06.11
초보자를 위한「MySQL 백업·복구」강좌  (0) 2009.06.10
mysql 기본문법  (0) 2009.06.10