MYSQL front to back

The dead of night is always Xiangpaqilai write Diansha!
-
-
want to write about all the mysql, you install SQL statements from it!
---

  • Installing MySQL Reference is often the thing

  • MySQL data connection

    mysql -h localhost -u root -p
    and enter the password to connect, after a successful connection is
    MySQL -u root -p
    the Enter password:
    .. is available for purchase at The MySQL Monitor Commands to End with; or \ G
    Your MySQL Connection the above mentioned id IS 7
    Server Version : 5.6.25 MySQL Community Community Server (the GPL)
    MySQL>等待输入指令

  • Database definition statements, commonly used commands
  1. Create a database

    create database demodb;
    Query OK, 1 row affected (0.00 sec) 显示这样表示执行成功

  2. View database

    show databases;

  3. Select database

    use demodb;

  4. View the current library use which tables

    show tables;

  5. Delete Database

    drop database demodb;

  • Datasheet operation, common commands
  1. Create a table

    create table tb_demo(
    tbname varchar(10),
    tbdate date,
    tbsal float(10,2),
    tbno int(2)
    );

  2. View table field structure

    tb_demo dec;

  3. View table creation statement

    show create table tb_demo \G;

  4. Delete table

    drop table tb_demo;

Guess you like

Origin www.cnblogs.com/yymor/p/11456715.html