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:
- row: row
- 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:
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;
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:
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:
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:
- _: Match the current position of a single character
- %: 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:
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 数据库名;