bleer

欢迎你来到我的空间哦~

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

mysql启动

../bin/mysqld --defaults-file=./mysql/my.cnf --user=root

这里的--user是什么意思呢

 

mysql创建一个数据表student,需要有3个字段:id、name、age,其中指定唯一的索引是id。

mysql> create table student(
    -> id int not null,
    -> name varchar(16) not null,
    -> age int not null,
    -> unique index idx (id)
    -> );

  查看数据表:

mysql> desc teacher;
+-------+-------------+------+-----+---------+-------+
| Field | Type        | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id    | int(11)     | NO   | PRI | NULL    |       |
| name  | varchar(16) | NO   |     | NULL    |       |
| age   | int(11)     | NO   |     | NULL    |       |
+-------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

  查看索引

mysql> show index from teacher\G;
*************************** 1. row ***************************
        Table: teacher
   Non_unique: 0
     Key_name: idx
 Seq_in_index: 1
  Column_name: id
    Collation: A
  Cardinality: 0
     Sub_part: NULL
       Packed: NULL
         Null: 
   Index_type: BTREE
      Comment: 
Index_comment: 
1 row in set (0.00 sec)

ERROR: 
No query specified

  

posted on 2019-02-20 15:48  bleer  阅读(173)  评论(0编辑  收藏  举报