当前位置:网站首页>MySQL: how are MySQL clients and servers connected?
MySQL: how are MySQL clients and servers connected?
2022-07-22 05:47:00 【Oceanstar's study notes】
- Running MySQL Both the server and the client are essentially a process on the computer
- So the process that the client process sends a request to the server process and gets a response is essentially a Interprocess communication The process
- MySQL Support multiple interprocess communication modes
The process of connecting the client and the server
TCP/IP
- In the real world , The database server process and the client process may run on different hosts , They must communicate with each other through the network
- MySQL use TCP As a network communication protocol between server and client , The client is through IP Address + port To uniquely identify which server to connect to
- By default ,MySQL The server will listen to the local
3306
port
problem : If 3306 What if the port is occupied ?
- Server side : stay Start the server when , Can pass -P Specify the port to listen on , For example, the following server monitors 3307:
$ mysqld -P3307
problem : If the client and server are not on the same host
- Start client Must pass -h The command specifies the IP Address , such as :
$ mysql -h192.168.0.21 -uroot -P3307 -p
UNIX Domain socket
- If the server and client are on the same host , So you can go through UNIX Domain socket for interprocess communication
How to do the server ?
- After starting the server , The server will listen by default
/tmp/sock.sock
This domain socket - If you want to listen to sockets in other domains , You can specify :
mysqld --socket=/tmp/a.txt
How does the client do ?
When starting the client , When one of the following three situations occurs :
- Do not specify host name
- Specify the hostname as localhost
- It specifies
--protocol=socket
Start parameter of
The client process will connect to the local directory
/tmp/sock.sock
.If you want to connect to another domain socket :
mysql -hlocalhost -uroot --socket=/tmp/a.txt -p
Named pipes and shared memory
- windows It also supports communication between server processes and client processes through named pipes
Summary
No matter which way the client and server processes communicate , The final effect is that the client process sends a text to the server process (MySQL sentence ), After processing, the server process returns a piece of text to the client process ( Processing results ).
that , What does the server process do with the request sent by the client , To produce the final processing result ?
We will discuss later
边栏推荐
- Simulink modeling and Simulation of parallel fuzzy PID compound controller
- When the cold winter of mobile phones comes, Samsung is forced to snipe Chinese mobile phones, and apple stands alone on the mountain to see the scenery
- pdf. JS how to Preview PDF files of Base64 type
- 性能领域:你知道的越多,不知道的也就越多
- 图片信息用浏览器显示:data:image/png;base64,+图片内容
- 前两天面了个腾讯拿 38K 出来的,让我见识到了基础的天花板,今天share给大家~
- 专注跨境支付一体化服务 iPayLinks获《财资》3A亚洲奖
- js 图片转换base64 base64转换为file对象
- 国家互联网信息办公室对滴滴全球股份有限公司依法作出网络安全审查相关行政处罚的决定
- 【js基础】Math中random、floor、ceil方法的使用
猜你喜欢
随机推荐
ES6 from introduction to mastery 01:es6 introduction
半导体产业动态杂谈
How to use API interface to batch query book information?
Virtual machine cannot connect to the Internet
在代码评审中用好这7招,很容易就能建立起你的反对同盟
idea报错Port 8080 is already in use
【综合笔试题】难度 3.5/5,多解法热门二叉树笔试题
Share an introductory guide to canvas
Get meituan, hungry, take out CPS and rights link
Understand the domestic open source Magnolia license series agreement in simple terms
The ultra-low price of domestic chips, while being replaced by domestic products, has led to a large number of exports, putting pressure on American chips
ES6 from getting started to mastering 06: arrow function this direction and precautions
店铺那些违规会被官方二级处罚,最常见的4种
文件操作管理
高校重金引进23名菲律宾博士,有关部门已展开调查!
“中国网事·感动2022”二季度网络感动人物评选结果揭晓
容器学习中的简答题
初步认识Redis
上午面了个腾讯拿 38K 出来的,让我见识到了基础的天花板
Judging whether a person is reliable depends on these three points