MySQL Basic operation

Source: Internet
Author: User

MySQL generally does not enable the table key command completion by default. To enable the command completion feature, you can modify the/ETC/MY.CNF or/etc/mysql/my.cnf file.

1. View the database

Mysql> show databases; +--------------------+| Database           |+--------------------+| information_schema | | mysql              | | performance_schema |+--------------------+ 3  in Set (0.01 sec)

2.

The commands commonly used in the MySQL database process are listed below:

    • use database name : Select the MySQL database you want to manipulate, and all MySQL commands are only for that database after using this command.
    • SHOW DATABASES: lists a list of databases for the MySQL database management system.
    • Show TABLES: Displays all tables for the specified database and uses the use command to select the database to manipulate before using the command.
    • show COLUMNS from data table : Displays data table properties, property types, primary key information, whether null, default value, and other information.
    • Show index from data table : displays detailed index information for the data table, including primary key (primary key).
    • SHOW table STATUS like datasheet \g: This command will output the performance and statistics of the MySQL database management system.

3. Create a new database

CREATE DATABASE [new database];

4. Delete Database

drop database [existed database];

Drop database if exists [database not sure if exist];

5. Use the database

Use [one database];

6. Create a new table

CREATE TABLE student (no char, name varchar, primary key (NO));

7. Delete Table

drop table [a table];

8. Table renaming

Rename table [old name] to [new name]

9. Table Insert Data

INSERT into student (No,name) VALUES (' 2012001 ', ' Jodan ');

MySQL Basic operation

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.