"Mysql" command line

Source: Internet
Author: User

    • View database->show databases;
    • Build database->create database name;
    • Build table->use database name;->create table name (field);
    • View all tables->show tables;
    • View table information->desc table name;
    • Delete table->drop database name;
1 mysql> show databases;2 +--------------------+3 | Database |4 +--------------------+5 | information_schema |6 | mysql |7 | test |8 +--------------------+9 3 rows in Set (0.02 sec)Ten  One mysql> Create database addr; A Query OK, 1 row Affected (0.00 sec) -  - mysql> show databases; the +--------------------+ - | Database | - +--------------------+ - | information_schema | + | addr | - | mysql | + | test | A +--------------------+ at 4 rows in Set (0.00 sec) -  - mysql> use addr; - Database changed - mysql> show tables; - Empty Set (0.02 sec) in  - mysql> CREATE TABLE address ( to -ID int primary key auto_increment, + (), name varchar, - -street varchar, the City varchar, * , State varchar (), $ zip varchar (6)Panax Notoginseng ); - Query OK, 0 rows affected (0.19 sec) the  + mysql> show tables; A +----------------+ the | tables_in_addr | + +----------------+ - | address | $ +----------------+ $ 1 row in Set (0.00 sec) -  - mysql> desc address; the +--------+-------------+------+-----+---------+----------------+ - | Field | Type | Null | Key | Default | Extra |Wuyi +--------+-------------+------+-----+---------+----------------+ the | id | int (11) | NO | PRI | NULL | auto_increment | - | name | varchar (20) |     YES | |                NULL | | Wu | street | varchar (20) |     YES | |                NULL | | - | city | varchar (20) |     YES | |                NULL | | About | state | varchar (20) |     YES | |                NULL | | $ | zip | varchar (6) |     YES | |                NULL | | - +--------+-------------+------+-----+---------+----------------+ - 6 rows in Set (0.02 sec) -  A mysql> INSERT INTO address (Name,street,city,state,zip) VALUES (' 111 ', ' 111 ', ' 111 ' + , ' 111 ', ' 111 '); the Query OK, 1 row affected (0.09 sec) -  $ mysql> INSERT INTO address (Name,street,city,state,zip) VALUES (' 222 ', ' 222 ', ' 111 ' the , ' 111 ', ' 111 '); the Query OK, 1 row affected (0.05 sec) the  the mysql> INSERT INTO address (Name,street,city,state,zip) VALUES (' 333 ', ' 333 ', ' 111 ' - , ' 111 ', ' 111 '); in Query OK, 1 row affected (0.05 sec) the  the mysql> SELECT * From address; About +----+------+--------+------+-------+------+ the | id | name | street | city | state | zip | the +----+------+--------+------+-------+------+ the | 1 | 111 | 111 | 111 | 111 | 111 | + | 2 | 222 | 222 | 111 | 111 | 111 | - | 3 | 333 | 333 | 111 | 111 | 111 | the +----+------+--------+------+-------+------+Bayi 3 rows in Set (0.00 sec) the  theMysql>

"Mysql" command line

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.