云服务器网:购买云服务器和VPS必上的网站!

MySQL8.0连接协议及3306、33060、33062端口的作用解析

一、MySQL连接层
连接层为每一个连接保护一个线程。该线程处理查询履行。 在连接可以开始发送 SQL 查询之前,连接由验证用户名、密码和客户端主机。
连接层通过量种连接协议接受来自利用程序的连接:TCP/IP
UNIX 套接字
同享内存
命名管道以下图所示:

成功登录:

[root@hadoop1 ~]# mysql -P 33062
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 8.0.28 MySQL Community Server – GPL
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql>

网络监听情况:

[root@hadoop1 ~]# netstat -anltp | grep 33062
tcp 0 0 127.0.0.1:33062 0.0.0.0:* LISTEN 1104641/mysqld
[root@hadoop1 ~]#

设置最大连接数方便测试:

mysql> set global max_connections = 1;
Query OK, 0 rows affected (0.00 sec)

重新连接:

[root@hadoop1 ~]# mysql
ERROR 1040 (HY000): Too many connections
[root@hadoop1 ~]# mysql -P 33062 –protocol tcp
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 8.0.28 MySQL Community Server – GPL
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql>

从 MySQL 8.0.14 开始,MySQL 服务器允许专门为管理连接配置 TCP/IP 端口。这为用于普通连接的网络接口上允许的单个管理连接提供了一种替换方法,即便已建立了 max_connections 连接。只有在启动时设置了 admin_address 系统变量以唆使管理接口的 IP 地址时,该接口才可用。如果未指定 admin_address 值,则服务器不保护管理界面。

只有SERVICE_CONNECTION_ADMIN 权限的用户才允许连接。没有限制管理连接的数量。 MySQL 服务器使用 DNS(域名系统)来解析使用 TCP/IP 协议连接的客户端主机的名称,并将它们存储在主机缓存中。对在名称解析进程中出现性能问题的大型网络,请使用 –skip-name-resolve 选项禁用 DNS 或增加 –host-cache-size 选项的值。

以上为个人经验,希望能给大家一个参考,也希望大家多多支持。

本文来源:https://www.yuntue.com/post/153657.html | 云服务器网,转载请注明出处!

关于作者: yuntue

云服务器(www.yuntue.com)是一家专门做阿里云服务器代金券、腾讯云服务器优惠券的网站,这里你可以找到阿里云服务器腾讯云服务器等国内主流云服务器优惠价格,以及海外云服务器、vps主机等优惠信息,我们会为你提供性价比最高的云服务器和域名、数据库、CDN、免费邮箱等企业常用互联网资源。

为您推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注