After downloading the MySQL
source code and installing
One, start the MySQL
server program
- In the
unix
system,
1.1mysqld
andmysqls_safe
,mysqld.server
,mysqld_multi,
mysqls_safe
indirectly callmysqld
,mysqld.server
will be an indirect callmysqls_safe
. - In the
windows
system,
2.1 manually start the executable fileMySQL
in thebin
directory of the installation directoryMysqld
.
2.2 Register as awindows
service and start theMysql
server program.
2. Start the MySQL
client program
Through bin
the executable file in the directory mysql
, you can interact with the server program. When starting this program, you need some parameters:
mysql -h主机名 -u用户名 -p密码
-p
There can be no blank characters between the password and the password value (there can be parameters between other parameter names and parameter values)
Client and server
MySQL
UsingTCP
as a network communication protocol between the server and client, using theTCP/IP
inter-protocol, used for communication processIP地址+端口号
,MySQL
will start the default application server3306
port number.- Whenever a client program connects to the server program, the server process will create a special thread to handle the interaction with the client. When the client disconnects from the server, the server does not immediately destroy the thread, but caches the thread, and when a new client connects, the thread is allocated to the client.
MySQL
The query request that has just been processed will be cached. This query request can be shared among different clients. If the request contains certain system functions, functions, and system tables, the request will not be cached, such asnow()
; The time queried is definitely different, so it will not be cached. If the structure or data of the table is changed, the cache of the table will be invalidated and deleted from the query.- The storage engine is mainly responsible for physically representing data, how to access data, and how to write data to specific physical storage. The storage engine is responsible for reading and writing data in the table. We can The tables are set with different storage engines, and tables managed by different storage engines may have different storage structures and different read and write methods.
- People
MySQL
simply divide the server processing request process intoserver
layers and storage engine layers. Functions that do not involve real data access are divided into layers, andserver
the parts that access real data are divided into storage engine layers. The storage engineserver
layer provides a unified calling interface for the layers. It contains dozens of low-level functions for different purposes.srever
The interaction between the layer and the storage engine layer is based on records. InnoDB
Starting from theMySQL5.5.5
version asMySQL
the default engine, the previous default version isMyISAM
. The storage engine of the table can be modified.