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 setConnected 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: f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8f9a7e8f8< XRuntime: 0.000000< XPoweredBy: PHP 7.2.240ubuntu0.16.04.1<Ignoring the responsebodyConnection #0 to host your_mysql_host left intact
4、如果端口未开放,你将看到类似以下的输出:
Rebuilt URL to: http://your_mysql_host:3306/ Trying your_mysql_host...TCP_NODELAY setconnect to your_mysql_host port 3306 failed: Connection refusedFailed to connect to your_mysql_host port 3306: Connection refusedClosing connection 0
通过观察输出结果,你可以判断MySQL端口是否开放。
现在你可以尝试使用CURL来检查MySQL端口是否开放了。如果你遇到了问题,可以随时提问或查阅相关文档以获得帮助。
感谢阅读!如果您有任何疑问,请随时留言。
```