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


当前第2页 返回上一页

修改my.cnf

admin_address='localhost'

修改前后对比: 

[root@hadoop1 ~]# mysql -e "show variables like 'admin%'";
+------------------------+-----------------+
| Variable_name          | Value           |
+------------------------+-----------------+
| admin_address          |                 |
| admin_port             | 33062           |
| admin_ssl_ca           |                 |
| admin_ssl_capath       |                 |
| admin_ssl_cert         |                 |
| admin_ssl_cipher       |                 |
| admin_ssl_crl          |                 |
| admin_ssl_crlpath      |                 |
| admin_ssl_key          |                 |
| admin_tls_ciphersuites |                 |
| admin_tls_version      | TLSv1.2,TLSv1.3 |
+------------------------+-----------------+
[root@hadoop1 ~]# systemctl restart mysqld.service 
[root@hadoop1 ~]# mysql -e "show variables like 'admin%'";
+------------------------+-----------------+
| Variable_name          | Value           |
+------------------------+-----------------+
| admin_address          | localhost       |
| admin_port             | 33062           |
| admin_ssl_ca           |                 |
| admin_ssl_capath       |                 |
| admin_ssl_cert         |                 |
| admin_ssl_cipher       |                 |
| admin_ssl_crl          |                 |
| admin_ssl_crlpath      |                 |
| admin_ssl_key          |                 |
| admin_tls_ciphersuites |                 |
| admin_tls_version      | TLSv1.2,TLSv1.3 |
+------------------------+-----------------+
[root@hadoop1 ~]# 

成功登录:

[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 选项的值。

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

更多相关Mysql内容来自木庄网络博客


标签:Mysql

返回前面的内容

相关阅读 >>

mysql设计规范与原则

mysql 的10大经典优化案例场景实战

mysql的变量有哪些?怎么用?

如何让mysql中单句实现无限层次父子关系查询

mysql中逻辑查询处理的介绍(代码示例)

mysql mid()函数的用法详解(代码示例)

mysql如何设置数据表的主键及自增长

怎么利用cmd进入mysql

如何利用xtrabackup备份mysql数据库

布尔教育燕十八mysql入门视频资料分享

更多相关阅读请进入《mysql》频道 >>


数据库系统概念 第6版
书籍

数据库系统概念 第6版

机械工业出版社

本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...