[mysql] 리눅스 쉘상태에서 DB 및 테이블 생성(mysqlshow)
DB 생성
[root@byungun ~]# cat temp.sql
create database tempdb;
[root@byungun ~]# mysql -u root -p mysql < ./temp.sql
[root@byungun ~]# mysqlshow -u root -p
Enter password:
+--------------------+
| Databases |
+--------------------+
| information_schema |
| first |
| mysql |
| tempdb |
| test |
+--------------------+
[root@byungun ~]#
테이블 생성
[root@byungun ~]# cat temp_table.sql
create table temptable (
uid mediumint(3) NOT NULL,
name varchar(12) NOT NULL,
PRIMARY KEY (uid) );
[root@byungun ~]# mysql -u root -p tempdb < ./temp_table.sql
Enter password:
[root@byungun ~]#
[root@byungun ~]# mysqlshow -u root -p tempdb temptable
Enter password:
Database: tempdb Table: temptable
+-------+--------------+-------------------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------+--------------+-------------------+------+-----+---------+-------+---------------------------------+---------+
| uid | mediumint(3) | | NO | PRI | | | select,insert,update,references | |
| name | varchar(12) | latin1_swedish_ci | NO | | | | select,insert,update,references | |
+-------+--------------+-------------------+------+-----+---------+-------+---------------------------------+---------+
[root@byungun ~]#