当前位置:网站首页>Several points in MySQL that are easy to ignore and forget
Several points in MySQL that are easy to ignore and forget
2022-06-30 17:59:00 【The disease has turned yellow】
MySQL
Backup and recovery
Database backup :
The graphical interface is often easy to forget how to write commands after a long time
dos Enter... Under the window
mysqldump -u root -p -B databaseName1 [databaseName2 databaseNamen] > d:\\bak.sql
Table backup
mysqldump -u root -p databaseName tableName1 [tableName2 tableNamen] > d:\\bak.sql
recovery
mysql Input in
source d:\\bak.sql;
Common data types
varchar
Range 0-65535 byte Maximum 65532 byte (1~3 Bytes are used to record the size )
If the table code is utf8 varchar(size) size = (65535 - 3) / 3 = 21844
If the table code is gbk varchar(size) size = (65535 - 3) / 2 = 32766
That is, the maximum number of characters that can be specified when creating a table is the above two
char(4) and varchar(4) It means the character , Not bytes , There are four characters in both numbers and Chinese characters , The byte space occupied depends on the encoding .
timestamp
You can create a table with a statement If this field does not specify a value during creation and update, the current timestamp is used .
NOT NULL
DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP;
CRUD
count(*) And count( Column ) difference
- count(*): Return the number of rows of records that meet the conditions
- count( Column ) The statistical conditions of , How many in a column , But it will be ruled out null
Business
View the isolation level of the current session
SELECT @@tx_isolation;
View the current isolation level of the system
SELECT @@global.tx_isolation;
Set the isolation level of the current session
SET SESSION TRANSACTION ISOLATION LEVEL read uncommitted -- It can be followed by four isolation levels for example READ UNCOMMITTED
Set the current isolation level of the system
SET GLOBAL TRANSACTION ISOLATION LEVEL read uncommitted -- It can be followed by four isolation levels for example READ UNCOMMITTED
Global modification , stay my.ini Profile's [mysqld] Add or modify
# The equal sign is followed by four isolation levels for example READ UNCOMMITTED
transaction-isolation = read uncommitted
The transaction ACID characteristic
- Atomicity (Atomicity)
A transaction is an indivisible unit of work , Either the operations in the transaction occur , Or none at all .
- Uniformity (Consistency)
Transactions must transform the database from one consistent state to another .
- Isolation, (Isolation)
Transaction isolation is when multiple users access the database concurrently , A transaction opened by a database for each user , Can't be disturbed by the operation data of other transactions , Multiple concurrent transactions should be isolated from each other .
- persistence (Durability)
Once a transaction is committed , Its changes to database data are permanent , Next, even if the database fails, it should not have any impact .
Storage engine
Modify the storage engine
ALTER TABLE `tablename` ENGINE = innodb -- For example, it needs to be changed to innodb
边栏推荐
- [Netease Yunxin] playback demo build: unable to convert parameter 1 from "asyncmodalrunner *" to "std:: nullptr\u T"**
- A tough battle for Tencent cloud
- Solution: STM32 failed to parse data using cjson
- 流批一体在京东的探索与实践
- Canvas mouse control gravity JS effect
- Parker variable displacement piston pump pv092r1k1t1nmmc
- China Infrastructure Development Association: electronic contract is recommended
- Interview shock 60: what will cause MySQL index invalidation?
- Six pictures show you why TCP has three handshakes?
- Word中添加代码块(转载)
猜你喜欢

New research of HKUST & MsrA: about image to image conversion, finishing is all you need

2022上半年盘点:20+主流数据库重大更新及技术要点汇总

Inventory in the first half of 2022: summary of major updates and technical points of 20+ mainstream databases

New skill: accelerate node through code cache JS startup

Six photos vous montrent pourquoi TCP serre la main trois fois?

Word中添加代码块(转载)

Rexroth hydraulic control check valve z2s10-1-3x/

自旋锁探秘

Splitting. JS text title slow loading JS effect

Implementation of graduation project management system based on SSM
随机推荐
自旋锁探秘
Advanced Mathematics (Seventh Edition) Tongji University General exercises one person solution
. Net ORM framework hisql practice - Chapter 1 - integrating hisql
5g has been in business for three years. Where will innovation go in the future?
[sword finger offer] sword finger offer 53 - ii Missing numbers from 0 to n-1
Inventory in the first half of 2022: summary of major updates and technical points of 20+ mainstream databases
广电5G正式启航,黄金频段将如何应用引关注
Rexroth hydraulic control check valve z2s10-1-3x/
4年工作经验,多线程间的5种通信方式都说不出来,你敢信?
Shutter music recording playing audioplayers
Flutter custom component
[C language] detailed explanation of threads - multi threads for collaborative operation
MySQL之零碎知识点
Exch:Exchange Server 2013 即将终止支持
. Net ORM framework hisql practice - Chapter 1 - integrating hisql
Apache 解析漏洞(CVE-2017-15715)_漏洞复现
.NET ORM框架HiSql实战-第一章-集成HiSql
Exploration and practice of "flow batch integration" in JD
Nielseniq welcomes dawn E. Norvell, head of retail lab, to accelerate the expansion of global retail strategy
Implementation of graduation project management system based on SSM