Table of contents
MySQL service startup and connection (under Windows system)
database foundation
DBs and DBMSs
What is DB
A large amount of data is saved, and the data collection that can be accessed efficiently through computer processing becomes a database (Database), also known as DB.
What is a DBMS
The computer system used to manage the database is called DBMS
Why use a DBMS exclusively to manage databases?
- Can provide the format needed to manipulate large amounts of data
- It can realize the transformation ability required by reading and writing automation
- Can deal with emergencies (for example: when accidental deletion, hard disk failure, etc., DBMS can solve or avoid these situations)
type of database
RDB Relational Database
Based on the relational model, two-dimensional tables composed of rows and columns are used to manage data, and special SQL (structured query statements) are used to operate on data
Features:
- Use tables to store data, the format is uniform, and it is easy to maintain
- All relational databases can be operated with SQL language, with uniform standards and easy to use
The DBMS corresponding to this type of database is called RDBMS, and the representative RDBMS is as follows
MySQL open source RDBMS
Oracle Oracle's RDBMS
DB2 IBM's RDBMS
SQL Server Microsoft RDBMS
Postgre SQL open source RDBMS
Non-relational databases (collectively known as NoSQL not just SQL)
Non-relational database storage formats support documents, pictures, etc.; while relational databases only support basic types
- Key-value storage system (KVS Key-Value Store)
Use key-value pairs to store data (a combination of primary key Key and value Value), instead of a database that stores data in tables
Common such database management systems include: Redis, MemcacheDB, etc.
- Object Oriented Database (OODB Object Oriented Database)
There is a programming language called object-oriented language (Java, C++, etc.), and an object-oriented database is a database used to store these objects
Common such database management systems include: ObjectDB (java database), etc.
- document-oriented database
Store and retrieve documents, including XML, JSON, BSON and other formats
Common such database management systems are: MongoDB, ClouchDB, etc.
- graph database
Allows data to be stored as graphs
Common such database management systems are: Neo4j, JanusGraph, etc.
Structure of RDBMS
System structure when using RDBMS
RDBMS database and table relationship
Tables are stored in databases, and a database can store multiple tables
RDBMS data structure (table structure)
The columns of the table are called fields, which represent the columns of different data items stored in the list
A row of a table is called a record, which is equivalent to a piece of data
Precautions
Relational databases must read and write data in units of rows
Only one data can be entered in a cell
A column is a vertical entity of all information associated with a particular field in a table
MySQL service startup and connection (under Windows system)
service start
win+r
services.msc found mysql80 (close and start mysql service)
or under cmd
net start mysql80 open mysql service
net stop mysql80 close mysql service
client connection
method one:
Method 2: (Environment variables need to be configured first)
Configure mysql under cmd -h [sql IP address] -P [sql port number] -u [user name used for login] -p
-p means enter password
For example: mysql -h 127.0.0.1 -P 3306 -u root -p
Can be abbreviated as: mysql -u root -p