zoukankan      html  css  js  c++  java
  • 【数据库使用】mysql基本使用

    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 teacherG;
    *************************** 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
    

      

    大道至简
  • 相关阅读:
    18文件权限管理
    17用户身份管理
    16Shell脚本—计划任务服务程序
    15Shell脚本—流程控制
    14Shell脚本—判断语句
    13Shell脚本—编写简单脚本
    12Vim在系统配置中的应用示例
    11Vim文本编辑器
    10重要的环境变量
    09命令行通配符和转义字符
  • 原文地址:https://www.cnblogs.com/liurong07/p/10407096.html
Copyright © 2011-2022 走看看