zoukankan      html  css  js  c++  java
  • Create a database in mysql for mac

    Before reading the blog, make sure you have succcessfully installed mysql for mac.

    Create a database:

    1. login
    2. create a database
    3. create tables
    $ mysql -u root -p
    $ Enter password: ***
    Welcome...
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    /* view databases */
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | leave_info_system  |
    | mysql              |
    | performance_schema |
    | sys                |
    +--------------------+
    5 rows in set (0.03 sec)
    /* create new database */
    mysql> create database testDB;
    Query OK, 1 row affected (0.01 sec)
    /* If you want to operate at a specific database, you have to change to the db */
    mysql> use testDB;
    Database changed
    /* create new tables in testDB */
    mysql> create table testTB(
        -> testNum VARCHAR(16) NOT NULL,
        -> testName VARCHAR(32) NOT NULL,
        -> testDate DATE NOT NULL);
    Query OK, 0 rows affected (0.12 sec)
    /* view fields in testTB */
    mysql> describe testTB;
    +----------+-------------+------+-----+---------+-------+
    | Field    | Type        | Null | Key | Default | Extra |
    +----------+-------------+------+-----+---------+-------+
    | testNum  | varchar(16) | NO   |     | NULL    |       |
    | testName | varchar(32) | NO   |     | NULL    |       |
    | testDate | date        | NO   |     | NULL    |       |
    +----------+-------------+------+-----+---------+-------+
    3 rows in set (0.01 sec)
  • 相关阅读:
    CCPC 2020 长春站 部分简略题解
    atcoder arc106 D Powers
    循环节与拓展欧拉定理(广义欧拉降幂)
    最长公共上升子序列 题解
    namomo fish round1 A~C题解
    Codeforces Round #666 (Div. 2) A~E题解
    Educational Codeforces Round 93 Div2 A~E题解
    Codeforces Round #578 Div2 1200 A~E题解
    UVA11997 K Smallest Sums 题解
    LCA模板
  • 原文地址:https://www.cnblogs.com/22Kon/p/6713652.html
Copyright © 2011-2022 走看看