zoukankan      html  css  js  c++  java
  • mysql常用指令

    :~# mysql -u root -p
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or g.
    Your MySQL connection id is 3
    Server version: 5.7.27-0ubuntu0.16.04.1 (Ubuntu)

    Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

    mysql>
    mysql> ls
    ->
    ->
    ->
    -> ^C^C^C
    mysql>
    mysql>
    mysql>
    mysql>
    mysql>
    mysql> show databases;
    +--------------------+
    | Database |
    +--------------------+
    | information_schema |
    | django |
    | mysql |
    | performance_schema |
    | sys |
    +--------------------+
    5 rows in set (0.00 sec)

    mysql>
    mysql>
    mysql> use django;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A

    Database changed
    mysql>
    mysql> show tables;
    +------------------+
    | Tables_in_django |
    +------------------+
    | ranking |
    +------------------+
    1 row in set (0.00 sec)

    mysql>
    mysql> use table ranking;
    ERROR 1049 (42000): Unknown database 'table'
    mysql> use ranking;
    ERROR 1049 (42000): Unknown database 'ranking'
    mysql> alter table ranking add hash varchar(50);
    Query OK, 0 rows affected (0.03 sec)
    Records: 0 Duplicates: 0 Warnings: 0

    mysql>
    mysql>
    mysql>
    mysql> show tables;
    +------------------+
    | Tables_in_django |
    +------------------+
    | ranking |
    +------------------+
    1 row in set (0.00 sec)

    mysql> show columns from ranking;
    +----------+--------------+------+-----+---------+----------------+
    | Field | Type | Null | Key | Default | Extra |
    +----------+--------------+------+-----+---------+----------------+
    | id | int(11) | NO | PRI | NULL | auto_increment |
    | username | varchar(100) | NO | | NULL | |
    | mark | int(11) | NO | | NULL | |
    | hash | varchar(50) | YES | | NULL | |
    +----------+--------------+------+-----+---------+----------------+
    4 rows in set (0.00 sec)

    mysql>
    mysql>
    mysql>
    mysql> show columns from ranking;

    create table ranking (
    id int primary key auto_increment,
    username varchar(100) not null default '',
    mark int not null default 0,
    hash varchar(50) ,
    date date,
    imgpath varchar(50)
    );

    INSERT INTO ranking(username, mark, date, imgpath, hash) VALUES ('小春', 81.918, '2019-10-27 07:30:39', '小春_81.918_20191027073039.jpg', 'cd9f9fcf1f7d7d3f');

  • 相关阅读:
    Android Studio keymap到Eclipse后,查找下一个同样变量快捷键Ctrl+K失效
    阿里云cenos 6.5 模板上安装 docker
    java 实现打印当前月份的日历
    makefile redefinition or previous definition
    aix用户登录次数受限问题(3004-300 输入了无效的登录名或password)
    BASH 文本模版的简单实现 micro_template_compile
    Eclipse+Maven+Spring+CXF 构建webservice 服务
    GBX的Graph(最短路)
    CSS布局篇——固宽、变宽、固宽+变宽
    考研学生应该知道:研究方向和开发技术
  • 原文地址:https://www.cnblogs.com/Ph-one/p/11747517.html
Copyright © 2011-2022 走看看