新聞中心
bash,curl -v --http1.1 "http://目標(biāo)IP地址:端口號(hào)/",`,,將"目標(biāo)IP地址"替換為實(shí)際的MySQL服務(wù)器IP地址,將"端口號(hào)"替換為實(shí)際的MySQL端口號(hào)(默認(rèn)為3306)。,,3. 如果端口開放,你將看到類似于以下的輸出:,,`bash,* Rebuilt URL to: http://目標(biāo)IP地址:端口號(hào)/,* Connection state changed (IHLAST, keepalive (fd=3))!,`,,如果端口未開放,你將看到類似于以下的輸出:,,`bash,* Rebuilt URL to: http://目標(biāo)IP地址:端口號(hào)/,* Connection state changed (IHLAST, keepalive (fd=3))!,* TCP_NODELAY set,* Connected to 目標(biāo)IP地址 (目標(biāo)IP地址) port 端口號(hào) (#0),* GET / HTTP/1.1,* Host: 目標(biāo)IP地址:端口號(hào),* User-Agent: curl/7.64.1,* Accept: */*,* Empty reply from server,* Connection #0 to host 目標(biāo)IP地址 left intact,curl: (56) Empty reply from server,“,,在這種情況下,端口可能未開放或MySQL服務(wù)未運(yùn)行。請(qǐng)檢查MySQL服務(wù)器的配置和狀態(tài)。要使用CURL檢查MySQL端口是否開放,可以按照以下步驟操作:

專注于為中小企業(yè)提供成都網(wǎng)站制作、網(wǎng)站設(shè)計(jì)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)三臺(tái)免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了上千企業(yè)的穩(wěn)健成長(zhǎng),幫助中小企業(yè)通過(guò)網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。
1、打開命令行終端(Windows下為cmd,Linux和Mac下為Terminal)。
2、輸入以下命令,將your_mysql_host替換為你的MySQL服務(wù)器地址,將your_username替換為你的MySQL用戶名,將your_password替換為你的MySQL密碼,將3306替換為你的MySQL端口號(hào)(如果不同的話):
curl v http1.1 "http://your_mysql_host:3306/" user your_username:your_password
3、觀察輸出結(jié)果,如果端口開放,你將看到類似以下的輸出:
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
通過(guò)觀察輸出結(jié)果,你可以判斷MySQL端口是否開放。
網(wǎng)頁(yè)名稱:用CURL檢查MySQL端口是否開放
文章路徑:http://m.fisionsoft.com.cn/article/cdghggg.html


咨詢
建站咨詢
