Han Shunping MySQL study notes 1

#01MySQL three-tier structure.
**Three-tier structure: DBMS database tables (not just tables) constitute the database**
Combined with the simple understanding of network programming learned previously: the client sends commands to connect to the corresponding port of the DBMS, and performs related operations on the database-table (essentially a file).
##1.1 The main form of data storage in the database is tables
Insert image description here
##1.2 SQL statement classification
**DDL:**Data definition language [create table, library]
**DML:**Database operation statements [add insert, modify updata, Delete delet]
DQL : Data query statement [select]
DCL : Data control statement [Manage database]
Insert image description here
##1.3 Create database

DROP DATABASE db02;
#未指定字符集与校对规则 默认是utf8 utf8_general_ci(不区分大小写)
#创建表 默认字符集与校对规则跟所属数据库一致 默认是utf8 utf8_general_ci
CREATE DATABASE db02
#创建数据库db03,字符集utf8 校对规则utf8_bin(区分大小写)
CREATE DATABASE db03 CHARACTER SET utf8 COLLATE utf8_bin

##1.4 View and delete database

#演示删除、查询数据库
SHOW DATABASES
#查看前面创建的数据库定义信息
SHOW CREATE DATABASE db03

##1.5 Backup and restore database

#备份 要求再DOS下执行mysqldump指令 其存在在mysql安装目录下\bin
#这个备份文件就是对应的sql语句
mysqldump -u root -p hsp -B db02 db03 > d:\\bak.sql
DROP DATABASE db01

#恢复数据库(注意:进入Mysql命令行在执行)
source d:\\bak.sql
#第二个方法:直接执行bak.sql的内容

Back up the table, pay attention to the difference from backing up the database
Insert image description here

Guess you like

Origin blog.csdn.net/m0_48991950/article/details/131174888