6.1 Storage engine, character set, mysql database operation

View the storage engines supported by the current database

show engines;

InnoDB storage engine

It is transaction (Transaction) safe and supports foreign keys (foreign key).
MySQL's default storage engine

MyISAM storage engine

Most tools with check and repair tables
are not transaction safe and do not support foreign keys
if a table requires a lot of select

MEMORY storage engine

Store the data in the table in memory. If the database restarts or crashes, the data in the table will also be lost

MERGE storage engine

exercise

The storage engines supported in MySQL include InnoDB, MyISAM, MEMORY, MERGE


character set

It is a set of text symbols and their encoding and comparison rules

Character sets supported by MySQL

Support multiple character sets, the same character set can be used in different fields of the same server, the same database or even the same table

show character set

The MySQL character set includescharacter setandproofreading rulestwo concepts.

character set

Used to define the way MySQL stores strings,

proofreading rules

Defines how to compare strings

MySQL supports more than 70 collation rules for more than 30 character sets


create database

CREATE {
   
   DATABASE | SCHEMA}[IF NOT EXISTS] 数据库名
[[DEFAULT] CHARACTER SET 字符集名]
[[DEFALUT] COLLATE 校验规则名]

MySQL is case insensitive
Example: Two syntaxes to create a database named StudentInfo

CREATE DATABASE StudentInfo;
CREATE DATABASE IF NOT EXISTS StudentInfo;

Set the database character set to GBK

DEFAULT CHARACTER SET gbk;

Set the verification rule to gbk_chinese_ci

COLLATE gbk_chinese_ci;

modify database

Determine whether the database exists

IF NOT EXISTS

view all databases

show databases;

delete database

DROP DATABASE [IF EXISTS] db_name

select database

use <数据库名>

After executing the above command, you have successfully selected the RUNOOB database, and all subsequent operations will be executed in the RUNOOB database.

Guess you like

Origin blog.csdn.net/qq_25887493/article/details/123826646