mariadb database infrastructure

1. Introduction Database

       Simply put, the database is a repository of data warehouse, the warehouse is in accordance with certain data structure (data structure refers to the link between the organization of data or data) to organize, store, and we can provide through a database of more approach to managing data in the database

       Easier to understand the image, we live tracking database and storage room to store the debris of the warehouse of the same nature, the difference is just nowhere to store things, utility room entity store objects, and data is stored in the database, the database so that we there is a preliminary understanding.

       Database born in 1950, with the development of information technology and the continuous progress of human society, especially after 2000, the database is not only the storage and management of data, and the user needs to be converted into a variety of data management mode, databases there are many types and functions, from the simplest form various data stores to be able to carry out mass data storage of large database systems have been widely used in various aspects.

2. Database species

Relational databases: a hard disk-based storage, the database is composed of a plurality of tables, data is stored in the table

oracle,db2,sqlserver,mysql,mariadb

Non-relational databases: Data stored value in the form of: memory-based storage, key

mongodb,redis

3. The two types of database comparison

 

4. Data storage - rows and columns

1) th column (Column): a field in a table, the table consists of one or more columns, a part information table stored in the column

Each column stores a specific information. For example, in the customer table, a storage customer number, customer name stored in another column, and the address, city, state, zip code stored in the respective column. Each column in the database has a corresponding data type, the data type of the column defines what type of data can be stored. For example, if a column number to be stored, numeric data types should be used. If a column store dates, text, prompts, you need to specify the amount of money with the appropriate data type.

2) th row (Row): a record in the table

The data stored in the line table where the table as a spreadsheet-like grid, a vertical column is the row in the grid column of the table, is the horizontal row of the table. For example, the number of customers in each table may store a customer line, the number of rows in the table is recorded in the table.

Note: NULL is used to refer to a null value (no value) in SQL, NULL, if a column is defined to allow NULL, the row when the insert or update, the column data can be ignored.

5.mariadb installation

Configuration mariadb10.3 version of the installation source

[mariadb]

name = MariaDB

baseurl = http://mirrors.ustc.edu.cn/mariadb/yum/10.3/centos7-amd64/

gpgkey=http://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB

gpgcheck=1

 

6. Check Database

1) show databases; # View database

2) mysqladmin --version # view the database version

3) show create database mysql; # View to create a database state

4) use db_name # use which library

5) mysql_secure_installation # database initialization, set a password

6) show tables # View table

 

7. Modify the database

1) create database test03 # create database

2) drop database test03 # delete database

3) alter database library name default character set = utf8; # modify the database default character set

4) create database testdb character set utf8; # modify the default character set when creating a database

 

8. User Management

1) select user (); # to view the current user

2) grant select, create, update, delete on test03.grade to 'aaa' @ '%'; # aaa Add to query, create, update, (on any host delete permissions)       

3) grant all privileges on test03.grade to 'aaa' @ '%'; # to the highest authority aaa grade table gives test03 database (on any host)            

4) show grants for 'aaa'; # View aaa user's privileges (root user)                        

5) revoke all on * * from 'aaa' @ '%';. # Aaa recover the highest authority in any table in any database                    

6) show grants # viewing rights

 

 

To be continued

Guess you like

Origin www.cnblogs.com/Agnostida-Trilobita/p/11122487.html