MySQL learning journey the next day

1.MySQL server architecture

MySQL server architecture consists of several layers:

1. database management system (outermost layer): DBMS, specialized management of all server-side content.
2. Database (second layer): DB, data warehouse storing more than one.
3. The two-dimensional data table (the third layer): Table, specific data entities stored exclusively.
4. Field (fourth layer): Field, particularly certain types of data storage (real memory cells).

Database Keyword:

  1. row: row
  2. column:列(field)

2. The basic database operations

The database is stored in the outermost data (maximum cell).

1. Create a database

The basic syntax: create database 数据库名字[库选项];
After the success:
Here Insert Picture Description
library option: Related property database
attributes include:
1. Character Set: charset character set, on behalf of all current data table stored in the default character set specified under the database (if the current is not specified, the default use of DBMS the (selected during installation))
basic syntax: `create database database name of the charset character set names;
Here Insert Picture Description
2. proof set: collate proofreading set

2. Display Database

Whenever a user creates a database through SQL commands, the system will produce a corresponding data storage folder (data directory)
as:
Here Insert Picture Description
and the folder is not empty, but there is a file opt, the corresponding database is stored options
database character set is not specified, then the DBMS will use the default character set
collation set with the character set

display all

Show all databases:
basic syntax show databases;
such as:
Here Insert Picture Description
Note:
information_schema: save all the database structure information (table, library)
MySQL: the core database: authority relations
performancce_schema: Library efficiency
test (if not you can build yourself a): Test: empty library

The display section

The display section database:
basic syntax: show databases like '匹配模式';
Match Mode:

  1. _: Match the current position of a single character
  2. %: More characters that match the specified location.

Such as: Get all database my beginning: 'my%';
acquiring beginning m, behind the uncertainty, ending the entire database database: 'm_database';
obtaining end database to database:‘%database’;

Display database creation statement

The basic syntax: show create database 数据库名;
such as:
Here Insert Picture Description

Note: See the instruction is not the original directive, it has been processed through the system
Select Database

Why choose a database?
A: The data is stored in the data table, the data stored in the database represents, if the data must be entered to operate the corresponding database.
The basic syntax:use 数据库名字;

Modify the database

Modify the database character set (database options)
basic grammaralter database 数据库名字 charset = 字符集;

Delete Database

The basic syntax:drop database 数据库名;

Delete temporary library cool, foot crematorium

Released six original articles · won praise 8 · views 91

Guess you like

Origin blog.csdn.net/qq_44128741/article/details/104223412