当前位置:网站首页>21. Basic usage of MariaDB
21. Basic usage of MariaDB
2022-04-23 21:59:00 【Dark night sword saint】
1. Three data management models :
hierarchical model : For example, one master and many slaves can be compared to one master process with many children
Network structure : The Lord and from much , You can trace multiple masters from one up
relational model : It can be regarded as a two-dimensional table composed of horizontal and vertical axes
1.1 data classification
Structured data 、 Semi-structured data 、 Unstructured data
**2. Relational database (RDBMS):** A database that uses a relational model to organize data , It stores data in the form of rows and columns , To make it easy for users to understand , This series of rows and columns in a relational database is called a table , A set of tables makes up the database .
3.RDBMS Basic concepts of design paradigm :
4. Database structure composition 
4.1、 Business 
4.2 、 Responsible for the interaction with the underlying disk Storage engine 、 A system for managing data The core 、 And the corresponding database driver is required SQL(SQL drive )
Storage engine : The database table information can be transformed into data that can be stored on disk , And can realize the related constraint function of the table , Also known as Table type
**4.3、SQL:** It is a database protocol, and its manifestation is SQL The driver , Can explain SQL Language and provide command line interface 
5. Basic concepts 

6、mariadb Compare with mysql New features 
7、: Three installation methods 
centos7 On can yum install mariadb, Directly provided package 
centos6 You need to compile and install mariadb
8.centos6 Compile and install mariadb
(1) establish mysql Users and groups
(2) Download the decompression package , Be sure to unzip to /usr/local Directory and create a connection 
(3) jurisdiction
cd /usr/local/mysql/
chown -R root:mysql ./*
(4) The data is stored in the installation directory by default data Next , For more security and capacity expansion, it's best to store it separately on a disk :
Create a disk partition and create a logical volume and set up boot auto mount
establish data Directory and set mysql Belong to the main genus group
** Add :** You can do it again centos6 To create a xfs Format the partition , First installation xfs modular
yum install xfsprogs
modprobe xfs In process module
see
modinfo xfs
(5) Execute the installation configuration method Sure –help View related options , There must be more mysql Execute the initialization script under the directory :
(6) Copy the template to generate the execution script and add it to the startup 
(7) Copy the generated configuration file , Copy the corresponding files according to the memory size used
Add :mariadb The last order of reading configuration files will take effect :


(8)、service mysqld start Start the test
(9)、 Related internal scripts 
Add :
9. Use of command line client program 




10 data type 
List data types :
HELP ‘Data Type’


11.SQL grammar 
12. Table grammar 
Example :
Delete table :DROP TABLE [IF EXIST] ‘tbl_name’
Modify table :
Add :
change: Modify field name
modify: Modify field properties
alter: Delete the default value of a field
Example :

Look at the index :SHOW INDEXES FROM ‘tbl_name’
Be careful : The key must be an index , An index is not necessarily a key
Delete index ALTER TABLE students DROP age ;
Example :
13. Indexes
usage :
Example :
14.DML:INSERT.DELETE,SELECT,UPDATE usage 
Insert examples :
Query examples :
SELECT * FORM students WHERE sid<3;
SELECT * FORM students WHERE gender=‘m’;
SELECT * FORM students WHERE gender IS NULL
SELECT * FORM students WHERE gender IS NOT NULL
SELECT * FORM students WHERE ORDER BY name;
SELECT * FORM students WHERE ORDER BY name DESC; ( null )
SELECT * FORM students WHERE ORDER BY name DESC LIMIT 2;( Only the first two )
SELECT * FORM students WHERE ORDER BY name DESC LIMIT 1,2; ( Skip the first and show the first two )
=》SELECT * FORM students WHERE sid>=2 and sid <=4;
=》 Same as above, another expression :SELECT * FORM students WHERE sid BETWEEN 2 AND 4;
SELECT * FORM students WHERE name LIKE ‘Z%’ ; (name Field Z Beginning line )
Regular expression based query , But try not to , Because of the need for regular expression engine, the query efficiency is slow
SELECT * FORM students WHERE name RLIKE ‘.u.’; ( Inquire about name There is... In the field u Lines of letters )
The alias sample :
Delete example :
DELETE FORM student WHERE sid=3;
Update example :
UPDATE student SET gender=‘f’ WHERE sid=4;
15.DCL


Authorization example :
View permission example :
View the current user authorization
SHOW GRANTS FOR CURRENT_USER;
Delete permission : REVOKE DELETE ON testdb.* FROM ‘testuser’@’%’;
版权声明
本文为[Dark night sword saint]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204200610396266.html
边栏推荐
- Is rust more suitable for less experienced programmers?
- Oracle intercepts special characters
- Plato farm is one of the four largest online IEOS in metauniverse, and the transaction on the chain is quite high
- 2.整理华子面经--2
- Common scenes of vector product in image
- [leetcode refers to offer 25. Merge two sorted linked lists (simple)]
- Leaf Smecta
- DeNO 1.13.2 release
- ubutnu20安装CenterNet
- [leetcode refers to offer 52. The first common node of two linked lists (simple)]
猜你喜欢
![[leetcode sword finger offer 10 - II. Frog jumping steps (simple)]](/img/ab/698810f6fe169adffc3bec5e0dc13f.png)
[leetcode sword finger offer 10 - II. Frog jumping steps (simple)]

Idea import a project

Based on jsplumb JS to achieve multi list one to many connection effect

在线时序流程图制作工具

Question brushing plan - depth first search DFS (I)
![[leetcode refers to offer 42. Maximum sum of continuous subarrays (simple)]](/img/e9/497a31cd70b9b21e4cb7845b688d18.png)
[leetcode refers to offer 42. Maximum sum of continuous subarrays (simple)]

flomo软件推荐

How to make Jenkins job run automatically after startup

Display, move, rotate

Deep understanding of modern mobile GPU (continuously updating)
随机推荐
thinkphp5+数据大屏展示效果
Sharpness difference (SD) calculation method of image reconstruction and generation domain index
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ‘:app:stripDe
在线时序流程图制作工具
Question brushing plan - depth first search (II)
Normalized transforms in pytorch The real calculation process of normalize
C winfrom DataGridView click on the column header can not automatically sort the problem
Two Stage Detection
C reads excel specific data into specific columns of DataGridView
Common scenes of vector product in image
IOT design and development
C language programming based on loop structure (PTA)
Ubuntu 20 installing centernet
Thread safe sigleton (singleton mode)
Chrome 94 introduces the controversial idle detection API, which apple and Mozilla oppose
April 24, 2022 Daily: current progress and open challenges of applying deep learning in the field of Bioscience
Ali has another "against the sky" container framework! This kubernetes advanced manual is too complete
Based on jsplumb JS to achieve multi list one to many connection effect
Error message: b04access.00f eve'. Read of address 000001B4
Sqlserver edits data in the query interface (similar to Oracle's edit and ROWID)