MySQL First knowledge

Source: Internet
Author: User

Win+r open Run, input cmd

Go to MySQL

Mysql–u root-p

-uroot can be attached to write,-P can also be attached to the middle of the password without spaces,-and between you and P is not a blank, [-p][root][-u] can only be lowercase, u represents the user,p password.

Set Password

Mysqladmin–u Root PASSWORD 789

The end of the SQL statement in MySQL must be added [;].

Quit MySQL

Exit or quit

Display Database

SHOW DATABASES;

Deleting a database

DROP dtabase Database name

Create a new user and give it permission to operate on the database

GRANT all privileges the database name. * To user name @localhost identified by password

Operation permissions Create, SELECT, UPDATE, DELETE, or all permissions all privileges

Specify the database to use

Use database name

To display the database currently in use

SELECT DATABASE ();

Create a new table

CREATE table table name (domain name data type column option);

Note: The last domain name is not used [,].

Show all the tables

SHOW TABLES;

Show Table Structure

DESC table name;

Delete a table

DROP table name;

Inserting data into the table

INSERT into table name (column name 1, column Name 2, ...) VALUES (data 1, Data 2,..);

Displaying Data in a table

SELECT column name 1, column Name 2, ... From table name

Related Article

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.