bash,curl -v --http1.1 "http://目标IP地址:端口号/",
`,,将"目标IP地址"替换为实际的MySQL服务器IP地址,将"端口号"替换为实际的MySQL端口号(默认为3306)。,,3. 如果端口开放,你将看到类似于以下的输出:,,
`bash,* Rebuilt URL to: http://目标IP地址:端口号/,* Connection state changed (IHLAST, keepalive (fd=3))!,
`,,如果端口未开放,你将看到类似于以下的输出:,,
`bash,* Rebuilt URL to: http://目标IP地址:端口号/,* Connection state changed (IHLAST, keepalive (fd=3))!,* TCP_NODELAY set,* Connected to 目标IP地址 (目标IP地址) port 端口号 (#0),* GET / HTTP/1.1,* Host: 目标IP地址:端口号,* User-Agent: curl/7.64.1,* Accept: */*,* Empty reply from server,* Connection #0 to host 目标IP地址 left intact,curl: (56) Empty reply from server,
“,,在这种情况下,端口可能未开放或MySQL服务未运行。请检查MySQL服务器的配置和状态。要使用CURL检查MySQL端口是否开放,可以按照以下步骤操作:
专注于为中小企业提供成都网站制作、网站设计服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业三台免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了上千企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。
1、打开命令行终端(Windows下为cmd,Linux和Mac下为Terminal)。
2、输入以下命令,将your_mysql_host
替换为你的MySQL服务器地址,将your_username
替换为你的MySQL用户名,将your_password
替换为你的MySQL密码,将3306
替换为你的MySQL端口号(如果不同的话):
curl v http1.1 "http://your_mysql_host:3306/" user your_username:your_password
3、观察输出结果,如果端口开放,你将看到类似以下的输出:
Rebuilt URL to: http://your_mysql_host:3306/ Trying your_mysql_host... TCP_NODELAY set Connected to your_mysql_host (your_mysql_host) port 3306 (#0) > GET / HTTP/1.1 > Host: your_mysql_host:3306 > UserAgent: curl/7.64.1 > Accept: */* > Authorization: Basic your_base64_encoded_username_and_password > < HTTP/1.1 401 Unauthorized < Server: nginx/1.14.0 (Ubuntu) < Date: Wed, 09 Jun 2021 08:23:41 GMT < ContentType: text/html; charset=UTF8 < ContentLength: 202 < Connection: keepalive < WWWAuthenticate: Basic realm="Restricted" < XContentTypeOptions: nosniff < XXSSProtection: 1; mode=block < XFrameOptions: SAMEORIGIN < ETag: W/"1424B5AOg" < CacheControl: maxage=0, mustrevalidate, nocache, nostore < XRequestId: f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8 < XRuntime: 0.000000 < XPoweredBy: PHP 7.2.240ubuntu0.16.04.1 < Ignoring the responsebody Connection #0 to host your_mysql_host left intact
4、如果端口未开放,你将看到类似以下的输出:
Rebuilt URL to: http://your_mysql_host:3306/ Trying your_mysql_host... TCP_NODELAY set connect to your_mysql_host port 3306 failed: Connection refused Failed to connect to your_mysql_host port 3306: Connection refused Closing connection 0
通过观察输出结果,你可以判断MySQL端口是否开放。
分享标题:用CURL检查MySQL端口是否开放
网站链接:http://www.mswzjz.cn/qtweb/news22/269272.html
攀枝花网站建设、攀枝花网站运维推广公司-贝锐智能,是专注品牌与效果的网络营销公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 贝锐智能