MySQL建表建库

查询数据库
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| shop |
| test |
+--------------------+
5 rows in set (0.00 sec)
创建数据库
    mysql> create database wiki;
    Query OK, 1 row affected (0.00 sec)
删除数据
    mysql> drop database wiki;
    Query OK, 0 rows affected (0.00 sec)
切换数据库
    mysql> use mysql;
    Database changed
查询数据表
    mysql> show tables;
    +---------------------------+
    | Tables_in_mysql |
    +---------------------------+
    | columns_priv |
    | db |
    | event |
    | func |
    | general_log |
    | help_category |
    | help_keyword |
    | user |
    +---------------------------+
    24 rows in set (0.00 sec)
删除数据表
    mysql> drop table `11`;
    Query OK, 0 rows affected (0.00 sec)

    mysql> drop table if exists `222`;
    Query OK, 0 rows affected (0.01 sec)
查询表结构
    root@localhost : [shop] 04:37:24>desc gods;
    +-------+---------+------+-----+---------+-------+
    | Field | Type | Null | Key | Default | Extra |
    +-------+---------+------+-----+---------+-------+
    | id | int(4) | YES | | NULL | |
    | name | int(20) | YES | | NULL | |
    | time | int(20) | YES | | NULL | |
    +-------+---------+------+-----+---------+-------+
    3 rows in set (0.00 sec)

 

posted @ 2017-05-04 20:38  sunmmi  阅读(589)  评论(0)    收藏  举报