도서관 I/Database
[바람이] MySql에서 자주 사용하는 기초 명령어 정리
바람이
2007. 7. 2. 14:53
1. mysql 각종 설정 확인
mysql> status
2. database확인
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql>
3. database 선택
mysql> use test
4. database 내에 table 확인 (먼저 use를 통해 database를 선택해야 함)
mysql> show tables;
5. database 생성 및 table 생성
mysql> create database [database 이름];
mysql> use [database 이름];
mysql> create table [table 이름] ([Attr 이름] [Attr 타입] , [Attr 이름] [Attr 타입] ... );
6. table의 schema 보기
mysql> describe [table 이름];
mysql> status
2. database확인
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql>
3. database 선택
mysql> use test
4. database 내에 table 확인 (먼저 use를 통해 database를 선택해야 함)
mysql> show tables;
5. database 생성 및 table 생성
mysql> create database [database 이름];
mysql> use [database 이름];
mysql> create table [table 이름] ([Attr 이름] [Attr 타입] , [Attr 이름] [Attr 타입] ... );
6. table의 schema 보기
mysql> describe [table 이름];