当前位置:网站首页>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
边栏推荐
- Mo Tianlun salon | Tsinghua qiaojialin: Apache iotdb, originated from Tsinghua, is building an open source ecological road
- 3D chart effectively improves the level of large data screen
- Flutter custom component
- 如何写一个技术方案
- MOOG servo valve d661-4577c
- K-line diagram must be read for quick start
- Shortcut keys for the rainbow brackets plug-in
- MSF后渗透总结
- Acwing game 57
- Map collection
猜你喜欢
TFTP download kernel, NFS mount file system
MOOG servo valve d661-4577c
Share 5 commonly used feature selection methods, and you must see them when you get started with machine learning!!!
Parker Parker sensor p8s-grflx
Importing alicloud ECS locally to solve deployment problems
Compile and generate busybox file system
流批一体在京东的探索与实践
JS from prototype chain to inheritance
2022上半年盘点:20+主流数据库重大更新及技术要点汇总
Advanced Mathematics (Seventh Edition) Tongji University General exercises one person solution
随机推荐
Servlet operation principle_ API details_ Advanced path of request response construction (servlet_2)
Network: principle and practice of server network card group technology
港科大&MSRA新研究:关于图像到图像转换,Finetuning is all you need
【剑指Offer】52. 两个链表的第一个公共节点
如何写一个技术方案
[proteus simulation] Arduino uno uses 74ls148 to extend interrupt
Small tools (3) integration knife4j3.0.3 interface document
Exch: database integrity checking
. Net ORM framework hisql practice - Chapter 1 - integrating hisql
Zero foundation can also be an apple blockbuster! This free tool can help you render, make special effects and show silky slides
Spin lock exploration
JS from prototype chain to inheritance
DeFi借贷协议机制对比:Euler、Compound、Aave和Rari Capital
[sword finger offer] 52 The first common node of two linked lists
NFT铸造交易平台开发详情
Write the simplest small program in C language Hello World
2022上半年盘点:20+主流数据库重大更新及技术要点汇总
Cloud practice of key business migration of Internet of things by well-known Internet housing rental service companies
Combination of applet container and Internet of things
【义修换届大礼包】