[MySQL] First introduction to databases

1. Concept

MySQL is essentially a network service based on the C(mysql)S(mysqld) mode.

  • mysqld: It is the server side of the database (it is a daemon process)
  • mysql: It is the client of the database

A database is a structured data file stored on disk or in memory.

Data

  • Symbolic records that describe things
  • Including numbers, text, graphics, images, sounds, file records, etc.
  • Stored in a unified format in the form of "records"

surface

  • Organize different records together
  • Used to store specific data

database

  • A collection of tables is a warehouse that stores data
  • A collection of related data stored in an organized manner
  • It is a warehouse that organizes, stores and manages data according to the data structure.

Database service: mysqld

Insert image description here

2.Basic use

Show current database list

show databases;

Insert image description here

Create database

create database helloworld(数据库名称);

Insert image description here

Creating a database is actually creating a directory file, and the created directory is stored in the /var/lib/mysql directory.

Use database

use helloworld(数据库名称)

Insert image description here

Create table

create table students(name varchar(32),age int,gender varchar(2));

Insert image description here

You can see that creating a table is actually creating a file in Linux.

Insert data into table

Insert image description here

View the data in the created table

Insert image description here

3.Classification of SQL

DDL【data definition language】: Data definition language, used to maintain the structure of stored data

Represents instructions: create, drop, alter

DML [data manipulation language]: Data manipulation language, used to operate data a>

Representative instructions: insert, delete, update

DML is divided into a separate DQL: Data Query Language, which represents the command: select

DCL [Data Control Language]: Data Control Language , mainly responsible for authority management and affairs

Representative instructions: grant, revoke, commit

4. Storage engine

The storage engine is the implementation method of how the database management system stores data, how to index the stored data, and how to update and query data.

The core of MySQL is the plug-in storage engine, which supports multiple storage engines.
Insert image description here

Guess you like

Origin blog.csdn.net/Tianzhenchuan/article/details/134348484