当前位置:网站首页>Get to know MySQL database

Get to know MySQL database

2022-06-24 03:11:00 GUTSZ

First time to know MYSQL database

1. What is? MYSQL?
MYSQL Is a relational database management system .
2. What is a database ?
A database is a collection of structured information and data , namely Database is used to store and query data .
3. Classification of database :
The database can be divided into Relational database and Non relational database .
(1) Relational database : A database that uses a relational model to organize data . A relational model is a two-dimensional table model , A relational database is a data organization composed of two-dimensional tables and their previous connections .
Presentation form of relational database :
 Insert picture description here
Common relational databases are :
Oracle,MYSQL,SQL Server,DB2.
(2) Non relational database : No rules based on SQL Realization , Now it's more about NoSQL database .
Common non relational databases are :
a. Based on key value pair (key-value):memcached,redis
b. Based on document type : Such as mongodb
c. Based on column family : Such as hbase
d. Based on pattern : Such as neo4j
(3) The difference between relational database and non relational database :
 Insert picture description here
4.MYSQL form :
MYSQL The composition of is divided into two parts :
Server side ( Service provider ), client ( Users of services ).

There is only one server , The client can have more than one .

We install on this machine MYSQL, It shows that we are both a server and a client , The embodiment of server-side service is :
 Insert picture description here
The client is using MySQL Command Line Client as follows :
 Insert picture description here
Use MySQL Command Line Client You can connect to the server , Enter the correct password to connect MYSQL( Server side ):
 Insert picture description here
 Insert picture description here
Ordinary console connection :
Besides using MySQL Command Line Client Outside the connection , We can also use normal console commands to connect , The connection command is :

mysql -h 127.0.0.1 -P 3306 -u root -p

among :

-h: host Abbreviation , Connect to the server ip Address ( If you connect this machine , It can be omitted );
-P: port Abbreviation of port number , by msql The port number on the server side , The default is 3306( If the machine is connected, you can omit );
-u: username Abbreviation , Indicates the user root Connect ;
-p: password Abbreviation , Indicates the password of the connection ;
Specify data when connecting :-D Database name

add to mysql environment variable
The following error may occur during the first connection :
 Insert picture description here
mysql Not an internal or external command , Nor are they runnable programs or batch files .
At this time, we need to mysql Add to the connection variable of the system :
1. find mysql Installation directory ;
 Insert picture description here
 Insert picture description here

2. take mysql Configure to the system environment .
 Insert picture description here
 Insert picture description here
 Insert picture description here
Restart the console , Use the command to connect as shown in the following figure :
 Insert picture description here
5.MYSQL Composition of server side :
mysql Important components of the server side are 4 individual :
database , surface , Field ( Column data ), data ( Row data ).
The database is equivalent to java The package name in , The table is equivalent to the class name , A field is equivalent to an attribute in a class , Data is equivalent to instantiating the object .
 Insert picture description here
6.MYSQL In the program “ Location ”
 Insert picture description here
7. summary :
(1)MYSQL Belongs to relational database , Software for storing and viewing data , Database is a concept ,MYSQL It belongs to concrete implementation .
(2) Database classification : Relational database 、 Non relational database 、MYSQL Belongs to relational database .
(3)MYSQL The composition is divided into client and server , The server side consists of the database 、 The data table consists of . A server can have multiple databases , One data can have multiple tables , There can be multiple data in a table .

原网站

版权声明
本文为[GUTSZ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202211643390642.html