1. function -cmd Get into command window First cd To mysql In the catalog bin Of Road operation -cmd Get into command window First cd To mysql In the catalog bin The path of . Be careful cd D Input directly on the disk D: Just ok. The rest will be "cd bin".

2.

Usually , After logging into the database , You also need to set the environment code of the current database . such as :

stay cmd In the command line mode of , The environment code is gbk

In our usual html The environment coding of web files is actually the coding of files , Such as utf-8,gbk,gb2312

The command to set the environment code :

set names gbk;

3.mysql>show

-> databases;

view the database

4 create new database .mysql>create database mydb1 chaset utf8;

The new name is mydb1 The encoding format is utf8 The database of .

5 Delete a database :

drop database Database name ;

6 Displays all databases in the current database system ( name )

show databases;

7 Be careful , After entering the database system , All commands need to use a semicolon (;) To the end , Then the command can be executed .

Access to database ( Using a database ): Our real operation on data must first choose to enter a certain database , To further operate the actual data .

use Database name ;

8 Data query

A large amount of data is stored in the database , We go through select Statement can transfer the data in the database “ Find out ”, But to be clear , The data we find out is just a copy of the actual data in the database , The data in the actual database is not reduced ( change )

form :

select Field 1, Field 2, …. from Table name 【where Conditional statements 】 【order Sort statement 】 【limit Number limit statement 】

Statement explanation :

1,              Field 1, Field 2,… It's the data segments that we want to extract , use “*” Can represent all the fields in the table .

2,              from Table name You can also get data from other tables , That's it “ Table joint ”( The employment class talks about ).

3,              order Sort statement : You can sort the extracted data by the specified field ( In positive or reverse order ).

a)         order by Field name 1 desc           —— In reverse order

b)         order by Field name 2 asc             —— positive sequence , here asc Keywords can be omitted

c)         order by Field 1 asc, Field 2 desc —— Start with fields 1 Positive order , Then take the field 2 Reverse order

4,              where Conditional statements : Same as delete and update Of the statement where, Common operators that can be used are :

a)         Logical operators :and(&&), or(||), not

b)         Arithmetic operator :+  -  *  /  %

c)         Comparison operator :>  >=  <  <=  =( be equal to ) <>( It's not equal to )

5,              limit Number limit statement : Used to limit the amount of data found under given conditions . There are two forms :

a)         limit Number n;         // Before removal n Data

b)         limit Location n1, Number n2;      // Take out from position n1 At the beginning n2 Data ( Location slave 0 Start )

give an example :

select * from tb2;

select * from tb2 order by  age;

select * from tb2 order by  age desc;

select * from tb2 where age > 25 order by  age desc;

select uName, age from tb2 where age > 22 and id >3 order by age desc;

select uName, age from tb2 where age > 22 and id >3 order by age desc limit 2;

select uName, age from tb2 where age > 22 and id >3 order by age desc limit 1, 2;

select uName, age from tb2 where age > 22 and id >3 or id=2 order by age desc, uName asc limit 1, 2;

9 data type

Mysql The common data types in are :

Integer class :tinyint(1 byte ), smallint(2 byte ), mediumint(3 byte ), int(4 byte ), bigint(8 byte )

Floating point class :float(4 byte ), double(8 byte )

Character type :varchar( Variable length characters , Maximum 65535), char( Fixed length characters , If it is insufficient, the right end should be filled with blank space , Maximum 255), text( Large text ).

Lengthening : When defining the length of a character field , It means that you can store so much at most , But when it's not enough , The length is calculated according to the actual situation .

Fixed length : When defining the length of a character field , It means that you can store so much at most , But when it's not enough , Will automatically fill in the space to the specified length . Fixed length is usually used for very few data storage requirements , For example, the postcode of China (6 position ), cell-phone number (11 position ),

Be careful : stay mysql, Character types are represented by single quotation marks .

Time type :datetime( Date time ), date( date ), time( Time )

stay mysql in , You can use a string to represent the time , such as ’2008-8-8 8:8:8’

10 Fiddler Simulate the interaction between the front end and the background

(1)post Insert

(2)get obtain

cmd Window configuration mysql More articles on the database

  1. DOS Window operation MySQL database

    What to learn this week : 1. Study MySQL database .Linux Private dishes : 2. Grade evaluation training : 3. practice MySQL database . practice CentOS7: Experimental content : 1. Use DOS The window enters MySQL database 2. solve MySQL ...

  2. To configure MySQL database

    One . To configure MySQL database 1. Unzip the green version mysql, Here's the picture Two . Installation services 1. function cmd( Administrator version , Otherwise, there is no permission ), Here's the picture 2. Run the command mysqld –install Installation services , Here's the picture : If you don't need to m ...

  3. Windows Platform installation configuration mysql database

    Windows Platform installation configuration mysql database author :Eric WeChat :loveoracle11g To download mysql Software https://www.mysql.com/downloads/ https://d ...

  4. Simple installation and configuration mysql database ( The green version )

    Catalog Green version download mysql The green version (5.7 Version of the installation and configuration ) Green version download : mysql Official website download address :https://www.oracle.com/index.html mysql The green version (5.7 Version of Ann ...

  5. DJango To configure mysql Database and database migration

    DJango To configure mysql Database and database migration One .Django To configure MySQL database stay settings.py Middle configuration import pymysql # To configure MySQL pymysql.install ...

  6. Django To configure MySQL database mysql

    Django To configure MySQL database stay settings.py Middle configuration DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # ...

  7. Django( 3、 ... and ) Model :ORM frame 、 Define the model class and create a corresponding database 、 To configure Mysql database

    One . Model overview https://docs.djangoproject.com/zh-hans/3.0/intro/tutorial02/ https://www.runoob.com/django/dj ...

  8. Xunmei VPS install and configure MySQL Database tutorial

    MySQL Related courses and knowledge :     Xunmei VPS install and configure MySQL Database tutorial     navicat8 management MySQL course - Create databases and import data     navicat8 management MySQL course - Manage build users and assign ...

  9. Original tutorial :SpagoBI4.2 Sinicization and configuration Mysql Database tutorial

    SpagoBI4.2 Sinicization and configuration Mysql Database tutorial Business Intelligence Suite SpagoBI Provide one based on J2EE The framework for managing BI Objects such as reports .OLAP analysis . The dashboard . Open source of scorecard and data mining model BI product . It provides B ...

Random recommendation

  1. GDataXMLNode application

    One .GDataXMLNode Installation and configuration process of 1. take GDataXMLNode Add documents to the project 2. towards Frameworks Add... To the file libxml2.dylib library 3. stay Croups & Files ...

  2. Entry level key driven —— Key driven notes poll Mechanism - Asynchronous notification - Synchronous mutex blocking - Timer anti shake

    The article corresponds to the second part of the video 12 course , The first 5.6.7.8 section . Before that, there is the driver writing of query mode , Interrupt mode driver writing , There is no such content in this article for the time being . But this article is based on these , If you have time to fill in the preceding contents . Key driven —— Press the button , ...

  3. How to solve Oracle 11g EM Website newspaper “ There is a problem with the security certificate for this site ”

    stay IE Input in https://localhost:1158/em Receiving a report of error , Cannot be opened ; Tips :“ Certificate error , There is a problem with this site security certificate ”, The solution is as follows : 1. Delete and rebuild dbconsole 2. Configure the necessary environment variables 1. ...

  4. cocos2d-x 3.x Build Android The development environment under the environment

    Some tools and software needed : 1.JDK   Official website download address :http://www.oracle.com/ttechnetwork/java/javase/downloads/index.html 2.Andr ...

  5. [ Daniel translation series ]Hadoop(21) appendix D.1 The optimized re partitioning framework

    appendix D.1 The optimized re partitioning framework Hadoop The community connection package needs to read all the values of each key into memory . How can I reduce End connection reduces memory overhead ? In the optimization provided in this paper , Just cache smaller data sets , Then traverse the larger number in the connection ...

  6. Html Plugins 6 Baidu news plug-in

    News free code "http://news.baidu.com/newscode.html , You can enter the keywords you want to subscribe to , According to the settings of the relevant options , Baidu is very fast in the current page of the text edit box to generate relevant code . ...

  7. SNS Social system “ThinkSNS V4.6” Detailed explanation of activity application functions and examples of application scenarios

    sns Social system ThinkSNS It has functions at present : Circle of friends ( Microblogging ). Micro bar ( Forum ). channel . Points Mall .IM Instant messaging . live broadcast . Question and answer . Activities . information (CMS). Shopping Mall . square . look for sb. . Search for . Comment on . give the thumbs-up . forward . Share . topic of conversation . integral . charge ...

  8. [UE4] Custom server Service

  9. mac OS X:[11] How to add a printer

    On the apple menu , Click... In the drop-down list 『 System preferences 』: Or in the Dock On , single click 『 System preferences 』 Icon . 2 stay 『 System preferences 』 Window , single click 『 Printers and scanners 』 Icon . 3 stay 『 Printers and scanners 』 Window , Click under the printer frame ...

  10. ASP.NET Core Medium WebSocket Support ( from MSDN)

    In this paper, ASP.NET Core in WebSocket How to get started . WebSocket (RFC 6455) It's an agreement , Supported by TCP The connection establishes a persistent two-way channel . It's used to benefit from fast real-time communication ...