[MySql learning experience], mysql learning experience

Source: Internet
Author: User

[MySql learning experience], mysql learning experience

1. Install MySql

1. Install the decompressed version

:

Http://dev.mysql.com/downloads/mysql/

Installation and configuration Tutorial: http://jingyan.baidu.com/article/f3ad7d0ffc061a09c3345bf0.html (Baidu experience)

2. Installation

:

Http://dev.mysql.com/downloads/windows/installer/5.7.html

Installation and configuration Tutorial: http://jingyan.baidu.com/article/851fbc37cda2203e1f15ab9b.html (Baidu experience)

Ii. First installation and Password Change

Set password for 'root' @ 'localhost' = password ('your own password') ps: Do not forget ";" (semicolon in English ).

Note: The installation password will be set during installation !!!

3. Several Basic and useful operation commands for MySql

1. show command:

Show databases; displays the databases in MySql;

Show tables; display all tables in the current database;

2. use command:

Use [database name] ps (you can skip the semicolon here );

4. Database Operations

1. create databases and users and assign User Permissions:

(1). create database [database name];

(2). create user [user name] identified by "password ";

(3). grant [select | alter | delete | insert | update | all privileges] on [database name | *]. [data table] to [user] @ 'hostname ';

2. delete a database:

Drop [database name];

3. Create a table:

Create table [table name] (

[Field name] [type] [null | not null],

[Field name] [type] [null | not null],

......);

4. insert data

Insert into [Table name] value (Field 1, Field 2, Field 3 );

5. query data

Select * from table;

6. modify data

Alter table [table name] rename [new table name]; Modify table Name

Alter table [table name] drop [field name]; delete a column in the table (row)

Alter table [table name] add [field name]; add a row to the table)

Alter table [table name] change [old field name] [new field name] [data type];

7. Delete

(1) Delete a table

Drop table [table name];

(2) Delete a row of data

Delete from [Table name] where [condition];

 

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.