"How does mysql run" reading notes one

After downloading the MySQLsource code and installing

One, start the MySQLserver program

  1. In the unixsystem,
    1.1 mysqldand mysqls_safe, mysqld.server, mysqld_multi,
    mysqls_safeindirectly call mysqld, mysqld.serverwill be an indirect call mysqls_safe.
  2. In the windowssystem,
    2.1 manually start the executable file MySQLin the bindirectory of the installation directory Mysqld.
    2.2 Register as a windowsservice and start the Mysqlserver program.

2. Start the MySQLclient program
Through binthe 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密码

-pThere 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

  1. MySQLUsing TCPas a network communication protocol between the server and client, using the TCP/IPinter-protocol, used for communication process IP地址+端口号, MySQLwill start the default application server 3306port number.
  2. 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.
  3. MySQLThe 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 as now(); 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.
  4. 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.
  5. People MySQLsimply divide the server processing request process into serverlayers and storage engine layers. Functions that do not involve real data access are divided into layers, and serverthe parts that access real data are divided into storage engine layers. The storage engine serverlayer provides a unified calling interface for the layers. It contains dozens of low-level functions for different purposes. sreverThe interaction between the layer and the storage engine layer is based on records.
  6. InnoDBStarting from the MySQL5.5.5version as MySQLthe default engine, the previous default version is MyISAM. The storage engine of the table can be modified.

Guess you like

Origin blog.csdn.net/weixin_43213064/article/details/110341833