하은양 믿음군 효실맘 호홍홍집s

DB, USER 생성 및 게시판 Table 생성 본문

가벼운 배움/MySql

DB, USER 생성 및 게시판 Table 생성

호홍홍집 2015. 4. 21. 16:08

use mysql;
insert into user (host,user,password) values ('localhost','user_id',password('user_pwd'));
flush privileges;

create database database_name;
grant all privileges on database_name.* to user_id@localhost;
flush privileges;

-- 모든 영역에서 접근가능토록처리...
insert into user (host,user,password) values ('%','user_id',password('user_pwd'));
flush privileges;
grant all privileges on database_name.* to user_id@'%';
flush privileges;

-- 특정IP만 접근 접근가능토록처리...
insert into user (host,user,password) values ('000.000.000.210','user_id',password('bosam2015pwd'));
flush privileges;
grant all privileges on database_name.* to user_id@'000.000.000.210';
flush privileges;

-- 관리자 테이블..
CREATE TABLE `TB_ADMIN`
(
  `ADM_ID`     VARCHAR (20) NOT NULL,
  `MEM_ID`     VARCHAR (10)                  NOT NULL,
  `ADM_PASS`   VARCHAR (100)                 NOT NULL,
  `ADM_NAME`   VARCHAR (20)                  NOT NULL,
  `ADM_DEPT`   VARCHAR (50),
  `ADM_EMAIL`  VARCHAR (50),
  `ADM_PHONE`  VARCHAR (50),
  `ADM_TYPE`   VARCHAR (20),
  `ADMGRP_ID`  VARCHAR (10),
  `REGDATE`    DATETIME,
  `REG_ID`     VARCHAR (30),
  `REG_IP`     VARCHAR (30),
  `EDITDATE`   DATETIME,
  `EDIT_ID`    VARCHAR (30),
  `EDIT_IP`    VARCHAR (30),
   PRIMARY KEY (`ADM_ID`)
 ) ENGINE=MyISAM DEFAULT CHARSET=euckr;

-- 공지사항
CREATE TABLE `TB_NOTICE`
(
  `BBS_SEQ`      bigint(20) unsigned NOT NULL,
  `PID`          bigint(20) unsigned,
  `TRI`          bigint(20) unsigned,
  `NO`          bigint(20) unsigned,
  `RID`          bigint(20) unsigned,
  `CEA`          bigint(20) unsigned,
  `SEE`          bigint(20) unsigned,
  `HIT`          bigint(20) unsigned,
  `NOTIFY`       bigint(20) unsigned,
  `CLASS`        VARCHAR (50),
  `GUBUN`        VARCHAR (30),
  `CATEGORYID`   VARCHAR (30),
  `SUBJECT`      VARCHAR (255),
  `DOCTYPE`      VARCHAR (1),
  `EMAIL`        VARCHAR (80),
  `PHONE`        VARCHAR (20),
  `URL`          VARCHAR (100),
  `WRITER`       VARCHAR (20),
  `WRITERID`     VARCHAR (20),
  `ORGWRITERID`  VARCHAR (20),
  `PASS`         VARCHAR (20),
  `RDATE`        DATETIME,
  `REGIP`        VARCHAR (20),
  `UPWRITERID`   VARCHAR (20),
  `UDATE`        DATETIME,
  `UPIP`         VARCHAR (20),
  `FILENAME1`    VARCHAR (50),
  `FILENAME2`    VARCHAR (50),
  `FILENAME3`    VARCHAR (50),
  `FILENAME4`    VARCHAR (50),
  `FILENAME5`    VARCHAR (50),
  `FILE1`        VARCHAR (50),
  `FILE2`        VARCHAR (50),
  `FILE3`        VARCHAR (50),
  `FILE4`        VARCHAR (50),
  `FILE5`        VARCHAR (50),
  `KEY1`         VARCHAR (30),
  `KEY2`         VARCHAR (30),
  `KEY3`         VARCHAR (30),
  `TAGNAME1`     VARCHAR (30),
  `TAGNAME2`     VARCHAR (30),
  `TAGNAME3`     VARCHAR (30),
  `IS_TOP`       VARCHAR (1),
  `IS_OPEN`      VARCHAR (1),
  `IS_DEL`       VARCHAR (1),
  `CONTENT`      text,
  PRIMARY KEY (`BBS_SEQ`)
) ENGINE=MyISAM DEFAULT CHARSET=euckr;