콘솔 화면에서 데이터베이스, 테이블 생성하기
CREATE TABLE `mgsdb`.`mgsuser` (
`mgs_userid` VARCHAR(10) NOT NULL ,
`mgs_username` VARCHAR(45) NULL ,
`mgs_passwd` VARCHAR(45) NULL ,
`mgs_belongto` VARCHAR(45) NULL ,
`mgs_userhp` VARCHAR(45) NULL ,
`mgs_usertel` VARCHAR(45) NULL ,
`mgs_useremail` VARCHAR(45) NULL ,
`mgs_right` VARCHAR(45) NULL ,
`mgs_date` DATETIME,
PRIMARY KEY (`mgs_userid`) );
| 간단한 Table 만들기
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.5.17 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
> Database 생성
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database mgsdb;
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mgsdb |
| mysql |
| performance_schema |
| sakila |
| test |
| world |
+--------------------+
7 rows in set (0.00 sec)
> Table 생성 / 생성된 Table 보기
mysql> use mgsdb;
Database changed
mysql> create table mgsdb;
mysql> show tables;
+-----------------+
| Tables_in_mgsdb |
+-----------------+
| mgsuser |
+-----------------+
1 row in set (0.00 sec)
mysql> desc mgsuser;
+---------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+-------+
| mgs_index | int(11) | YES | | NULL | |
| mgs_userid | varchar(10) | NO | PRI | NULL | |
| mgs_username | varchar(10) | YES | | NULL | |
| mgs_passwd | varchar(10) | YES | | NULL | |
| mgs_belongto | varchar(30) | YES | | NULL | |
| mgs_depart | varchar(30) | YES | | NULL | |
| mgs_userhp | varchar(30) | YES | | NULL | |
| mgs_usertel | varchar(30) | YES | | NULL | |
| mgs_useremail | varchar(30) | YES | | NULL | |
+---------------+-------------+------+-----+---------+-------+
9 rows in set (0.04 sec)
mysql>
반응형
'Database > Mysql' 카테고리의 다른 글
[Mysql/MariaDB] TXT,CVS 데이터를 한번에 INSERT 하는 법(BULK INSERT) (0) | 2012.01.12 |
---|---|
[Mysql] root의 계정 외부접속 허용하기 (0) | 2011.11.19 |
[Mysql] Illegal operation on empty result set. (0) | 2011.11.18 |