• mysql简单命令示例


    C:\mysql\bin>mysql -u root -p
    Enter password: ****
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 4
    Server version: 5.0.51b-community-nt MySQL Community Edition (GPL)

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | mytest             |
    | tjtz               |
    | tjtz_148280117     |
    +--------------------+
    5 rows in set (0.00 sec)

    mysql> create database mytest2;
    Query OK, 1 row affected (0.01 sec)

    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | mytest             |
    | mytest2            |
    | tjtz               |
    | tjtz_148280117     |
    +--------------------+
    6 rows in set (0.00 sec)

    mysql> use mytest2;
    Database changed
    mysql> create table testTable(
        -> id int(4) auto_increment not null primary key,
        -> name char(10not null,
        -> address char(50default 'jinan',
        -> year date);
    Query OK, 0 rows affected (0.09 sec)

    mysql> show tables;
    +-------------------+
    | Tables_in_mytest2 |
    +-------------------+
    | testtable         |
    +-------------------+
    1 row in set (0.05 sec)

    mysql> insert into testtable values('','zhangsan','','2011-12-29');
    Query OK, 1 row affected, 1 warning (0.00 sec)

    mysql> select * from testtable;
    +----+----------+---------+------------+
    | id | name     | address | year       |
    +----+----------+---------+------------+
    |  1 | zhangsan |         | 2011-12-29 |
    +----+----------+---------+------------+
    1 row in set (0.00 sec)

    mysql> update testtable set address='jiefang road';
    Query OK, 1 row affected (0.06 sec)
    Rows matched: 1  Changed: 1  Warnings: 0

    mysql> select * from testtable;
    +----+----------+--------------+------------+
    | id | name     | address      | year       |
    +----+----------+--------------+------------+
    |  1 | zhangsan | jiefang road | 2011-12-29 |
    +----+----------+--------------+------------+
    1 row in set (0.00 sec)

    mysql> insert into testtable values('','lisi',null,'2012-1-3');
    Query OK, 1 row affected, 1 warning (0.00 sec)

    mysql> select * from testtable;
    +----+----------+--------------+------------+
    | id | name     | address      | year       |
    +----+----------+--------------+------------+
    |  1 | zhangsan | jiefang road | 2011-12-29 |
    |  2 | lisi     | NULL         | 2012-01-03 |
    +----+----------+--------------+------------+
    2 rows in set (0.00 sec)

    mysql>
  • 相关阅读:
    win10 L2TP拨号
    Esxi直通板载Sata
    Esxi 增加网卡驱动 生成ISO
    IPMITOOL THRESHOLD 修改
    Reverse Engineering Supermicro IPMI
    Esxi通过RDM直通硬盘
    Centos 安装后优化
    Centos 6安装apache 2.4
    Try Catch Finally 中Finally的代码在什么时候不被执行
    用CutePDF AND GhostScript 生成PDF的处理流
  • 原文地址:https://www.cnblogs.com/bloodofhero/p/2315023.html
Copyright © 2020-2023  润新知