MySQL Beginner Beginners

Source: Internet
Author: User

It took me two nights to study MySQL's beginner application and record it here.

1. Installation under Windows system

I use the WIN10 system, in http://dev.mysql.com/downloads/mysql/download the corresponding version of MySQL, downloaded after the decompression can be.

After downloading, install, install and configure the steps to refer to http://jingyan.baidu.com/article/f3ad7d0ffc061a09c3345bf0.html.

After installation, enter the net start MySQL under DOS and return will start the MySQL service (note that the DOS window must be entered in Administrator mode, otherwise it will not start the service), after the start of input mysql-u root-p to log in, where, U root Indicates that the root user is logged in at this time. First login without password, press ENTER directly. Someone in the installation will encounter the need to password (that is, do not enter the password can not log in), but do not know the password, this is the way to find the MySQL installation folder, This folder will generally have a file called My-default.ini, to see if there is a file in this folder called My.ini, if not, will my-default.ini copy one and rename it to My.ini, save in this folder, open this My.ini, find
[Mysqld]
#skip-grant-tables

This ' # ' will be deleted and saved, then re-login, you can not use the password successfully landed.

2, the installation of Linux system

Installing MySQL under a Linux system is very simple and can be installed according to http://blog.csdn.net/fighter_yy/article/details/40753889.

3. Common SQL language

The SQL language is divided into 3 categories, namely

    • DDL: Data Definition language
    • DML: Data Manipulation language
    • DCL: Data Control Language

4. DDL

(1) operation of the database

    • Creating a database create databases XXX;
    • Show which database in the system show databases; (Note that there is a last s)
    • Select the database you want to manipulate use XXX;
    • Delete database drop databases XXX;

(2) In the case of a selected database, the operation of the data table

    • Create a table of data tables XXX (first column what is the type of the first column (such as: string (20)), what the second column is, the type of the second column, what the third column is, ...)
    • Shows which data tables are in this database show tables;
    • View the definition of a data table desc XXX;
    • * Detailed view of a datasheet definition show create table XXX \g;
    • Delete tables drop table XXX;

(3) Action on a field in a data table

Modify the data type of a column in a table ALTER TABLE XXX modify A B; Where A is the name of the column you want to modify, and B is the modified data type

Increase the table field (that is, increase the column of the tables, add a property) ALTER TABLE XXX Modify a B; Where A is the name of the column you want to modify, and B is the modified data type

5. DML

DML operations refer to the "Add, delete, change, and check" of the table records in the database, where "table records" generally refer to the rows of the database

(1) Increase--insert record

(2) by deleting--deleting records

(3) Change--Update record

 

(4) Check--Inquiry record

6. DCL

The DCL statement is primarily used by DBAs to manage the object permissions in the system, and typically developers use less

(1) Modify permissions

(2) How to use "Help"

7. Other

MySQL statement ends with ";" or "\g"

"\c" can be used to clear the command line

"Exit;" can be used to exit MySQL

net stop MySQL can be used to shut down the MySQL service under Windows system

  

 

(not to be continued)

MySQL Beginner Beginners

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.