14th Chapter-mysql

Source: Internet
Author: User

1 installation

Common versions of MySQL

GA: A widely used version

RC: Closest to the official version

Alpha and Bean: Beta version and beta version

There are two ways to install: Install packages and compress packages

1) Installing the MSI file

    

    

    

    

    

2) unzip the zip file

After extracting, add Bin directory to environment variable

Enter the bin directory to initialize the configuration

Mysqld--initialize-insecure

Installing Windows Startup Services

"C:\mysql-5.7.16-winx64\bin\mysqld"--install

    Start the service

net start MySQL

Log in to Database

Mysql-u root-p

2 Database Concepts

The development stage of database management technology

Manual Management

File Management

Database system

Classification of databases

    

1 hierarchical database and mesh database

Resolving data centralization and sharing issues

2 relational database

Resolving database independence and abstraction levels

Define the storage structure of the data

Boil down to a simple two-element relationship

3 Non-relational database

NoSQL (not only SQL) refers to non-relational databases, mainly for ultra-large-scale and high-concurrency

Key-Value Store database

Use a hash table primarily to add a query to delete data by key

Typical product: Redis

Column Store Database

Storing data in a column family is often used to store distributed, massive amounts of data

Typical product: HBase

Document-oriented database

Based on versioned documents, data can be stored in JSON and can be considered as an upgraded version of the key-value store database

Typical product: MongoDB, CouchDB

Graphics database

Sequential data is stored as graphs, entities are called fixed points, and relationships between entities are edges

Typical product: neo4j

DB database

DBMS Database management System

DBS Database System

DDL Database Definition Language

DML Data Manipulation language

DCL Data Control Language

3 Database and Database objects

The role of system data

  

Databases: Containers for storing database objects

Database objects: storage, management, and use of different structural forms of data, mainly including tables, views, stored procedures, functions, triggers and events, etc.

(1) View database

show databases;

(2) using the database

Use database name;

(3) Create a database

Create DATABASE name default CharSet "UTF8";

Set the character set of the database

Note the database name setting

Length to less than 128 bits

(4) Deleting a database

drop database name;

4 Engine and data type

The engine determines how the table is stored on the computer, how the data is stored and indexed, whether the transaction is supported

View supported engines for a database

Show engines;

In general:

The execution of orders to have the end of orders, general use; /g and/g

The first two effects are the same,/g can help to display more beautiful

Data type

(1) Integer type

tinyint, smallint, mediumint, Int/intrger, bigint

The corresponding number of storage bytes is 1, 2, 3, 4, 8

(2) Floating-point number type

float, double

Storage byte is 4, 8

(3) Date and time

Date, datetime, timestamp, time, year

    

(4) String type

char (number), varchar (number)
VARCHAR is a variable-length string

Tinytext, text, Mediumtext, Longtext

5 Operation of the table

Table operations include creating tables, viewing tables, deleting tables, modifying tables, and these operations are the most basic table management operations

5.1 Table

Represents the data that refers to a two-dimensional relationship

Line: Record

Columns: Fields

Index: Provides a way to quickly access data based on the order in which the specified database tables are established, and can supervise the data in the table so that the data in the column it points to is not duplicated

Triggers: A collection of user-defined things commands that execute this set of commands when a ransom for a table changes

To ensure the integrity and security of your data

5.1 Creating a Table

(1) Create a table

Create Table table name {    attribute name data type constraint condition;    ...}

(2) View the structure of the table

DESC table name;

  

  

      

  

    

    

    

    

    

    

      

  

  

With D is the server-side program.

Program without D is client

  

  

14th Chapter-mysql

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.