1. root 패스워드
mysqladmin -u root -p password xxxxxx

이때 패스워드를 물어오는데 처음에 설치시 정한게 없다면 그냥 엔터치면된다.

 2. DB 생성
mysql> create database devdb
    -> ;
Query OK, 1 row affected (0.00 sec)

mysql> 

3. DB 권한주기
root 로 접속한뒤에

grant select,insert,update,delete,create,drop
on DB명.* to '사용자계정'@'localhost'
identified by '루트패스워드';

ex)
grant select,insert,update,delete,create,drop
on devdb.* to 'xxxxx'@'localhost'
identified by 'xxxxx'; 

4. 사용할 DB 선정...
use DB명


5. 테이블 생성
create table users (
id varchar(10) primary key,
name varchar(20) not null,
password varchar(10) not null
)

마약 utf8 로 사용한다면?
create table users (
id varchar(10) primary key,
name varchar(20) character set utf8 not null,
password varchar(10) not null
)
로  name 에 대해 별도 지정 가능하다. 
 

 


+ Recent posts