Lecture 1 - MYSQL database creation and maintenance

MYSQL database creation and maintenance

Table of contents

1. Create/modify/select/delete database
2. MYSQL storage engine
3. MYSQL data type and selection

  1. value type
  2. string type
  3. datetime type
  4. other data types

4. Constraints of MySQL
5. Create/modify/view/delete data tables
6. Add/delete/modify/check record data in data tables
7. Backup and restore of MySQL data 8. Import and export
of MySQL data tables

1. Create/modify/select/delete database

1. Create
Syntax: create {datebase | schema }[if not exists]<database name>
[create_specification,…]
where the options for create_specification are as follows
[default] Character Set<character set>|[default]Collate <collation name>
Use the command: create datebases if not exists book character set UTF8;
use the Navicat tool:

insert image description here

Select the utf8 character set and select the uft8_general_ci collation.
2. Modify the database

Syntax: alter{database|schema}<database name>
[create_specification,…]
where the options of create_specification are as follows;
[default]Character Set <character set name>|[default]Collate <collation name>
use command: alter databases book character set gb2312 collate gb2312_chinese_ci;
use Navicat tool:

insert image description here

Select the gb2312 character set, and select the gb2312_chinese_ci collation.

3. Select the database

Syntax: use database name
4. Delete database

Syntax: drop datebases;

Second, the MySQL storage engine

The storage engines supported by MYSQL5.7 include: InnDB, MRG_MYISAM, MEMORY, BLACKHOLE, MyISAM, CSV, ARCHIVE, PERFORMANCE_SCHEMA, etc.

1. InnDB is the preferred engine for transactional databases. It is the default engine after version 5.5. It supports transaction security, row locking, data replacement, and external inspection. It also supports crash recovery and concurrency control. It does not support full-text indexing and hash indexing.
2. MYISAM is one of the most commonly used storage engines in Web, data warehouse and other application environments. The default engine before 5.5 has a high insertion and query speed, supports full-text indexing, does not support transactions, data caching and foreign keys 3.MEMORY
stores the data in the data table into the memory, and is used for querying and referencing other data table data The type provides access, the default is to use the hash index, and does not support the foreign key of the full-text index of the bookstore, and the security is not high.
InnDB is a good choice

Guess you like

Origin blog.csdn.net/weixin_45541388/article/details/102758465