首页 > 编程知识 正文

MySQL默认端口号是,mysql端口号是多少默认

时间:2023-05-06 18:47:45 阅读:185947 作者:1276

mysql的默认端口号

mysqlisverypopulardatabaseintheopensourcecommunity.whiledevelopingapplicationsorconnectingmysqldatabasewenedtospecifythemysyshem nthistutorialwewillearnmysqldefaultportnumberandalternativeportnumbers。

MySQL是开源社区中非常受欢迎的数据库。 在开发APP应用程序或连接到MySQL数据库时,必须隐式或显式指定MySQL端口。 在本教程中,您将学习MySQL的默认端口号和备用端口号。

TCP3306(TCP3306 ) thedefaultporthemysqlserviceistcp 3306.thisportcanbealsousedformariadbdatabaseserver。

MySQL服务的默认端口是TCP3306。 此端口也可用于MariaDB数据库服务器。

使用netstat命令列出wecanusenetstatcommandinordertolistmysql/mariadbdatabaseserverportnumber。

可以使用netstat命令列出MySQL/MariaDB数据库服务器的端口号。

$ sudo netstat-p-l-n|grepmysqllistwithnetstatcommand使用netstat命令更新wecanseefromoutputthatport 3306 portislisteningonttengonttttcomand

从输出中可以看到端口3306正在本地接口127.0.0.1上侦听

formariadbchangegrepmysqlwithgrepmariadb

对于MariaDB,请使用grep mariadb更改grep mysql

从数据库配置文件中查找(Find From DB Config File ) )。 watifmysqlserverdefaultportisdifferentfrom 3306.wehavesomeoptions.oneofthemislookingtotheapplicationdatabaseconfigfile.wave thisexampletheportnumber 3307 isspecifiedexplicitly。

如果MySQL服务器的默认端口与3306不同怎么办? 我们有几个选择。 其中之一是查找APP应用程序数据库配置文件。 可以从那里取得端口号。 在本例中,端口号3307被明确指定。

$ link=MySQL _ connect (POF tut.com :3307 )、' mysql_user '、' mysql_password ' ); 使用Nmap扫描搜索(Find By Nmap Scan ) )。 ifwehadnoclueabouttheportnumberwecanusesomesecuritynetworkscanningtoolnamednmap.wecanscanpopularorallportonthehostandfin

如果不知道端口号,可以使用nmapsecurenetworkscan工具。 您可以扫描主机上的常规端口或所有端口以找到MySQL服务。 以下命令扫描使用最多的1000个端口。

$ nmap-sc-SV 192.168.1.10 orwecanscanallportsofthegivenhost。

或者,您可以扫描特定主机上的所有端口。

$ nmap-p-- sc-SV 192.168.1.10使用查找SQL查询(Find with SQL Query )的配置文件属性查询

MySQL或MariaDB数据库服务器的配置参数也存储在变量中。 我们可以使用一些SQL命令来从以下环境变量中打印端口信息。

SHOW VARIABLES WHERE Variable_name = 'port'; Find with SQL Query 使用SQL查询查找

We can see that port variable is current set to  3306.

我们可以看到port变量当前设置为3306 。

.u6d2872611d58eaf25f23004868dbd910 , .u6d2872611d58eaf25f23004868dbd910 .postImageUrl , .u6d2872611d58eaf25f23004868dbd910 .centered-text-area { min-height: 80px; position: relative; } .u6d2872611d58eaf25f23004868dbd910 , .u6d2872611d58eaf25f23004868dbd910:hover , .u6d2872611d58eaf25f23004868dbd910:visited , .u6d2872611d58eaf25f23004868dbd910:active { border:0!important; } .u6d2872611d58eaf25f23004868dbd910 .clearfix:after { content: ""; display: table; clear: both; } .u6d2872611d58eaf25f23004868dbd910 { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u6d2872611d58eaf25f23004868dbd910:active , .u6d2872611d58eaf25f23004868dbd910:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u6d2872611d58eaf25f23004868dbd910 .centered-text-area { width: 100%; position: relative; } .u6d2872611d58eaf25f23004868dbd910 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u6d2872611d58eaf25f23004868dbd910 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u6d2872611d58eaf25f23004868dbd910 .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u6d2872611d58eaf25f23004868dbd910:hover .ctaButton { background-color: #E67E22!important; } .u6d2872611d58eaf25f23004868dbd910 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u6d2872611d58eaf25f23004868dbd910 .u6d2872611d58eaf25f23004868dbd910-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u6d2872611d58eaf25f23004868dbd910:after { content: ""; display: block; clear: both; } LEARN MORE  How to Install Mariadb / Mysql Server in Linux Fedora, CentOS and RedHat? .u6d2872611d58eaf25f23004868dbd910 , .u6d2872611d58eaf25f23004868dbd910 .postImageUrl , .u6d2872611d58eaf25f23004868dbd910 .centered-text-area { min-height: 80px; position: relative; } .u6d2872611d58eaf25f23004868dbd910 , .u6d2872611d58eaf25f23004868dbd910:hover , .u6d2872611d58eaf25f23004868dbd910:visited , .u6d2872611d58eaf25f23004868dbd910:active { border:0!important; } .u6d2872611d58eaf25f23004868dbd910 .clearfix:after { content: ""; display: table; clear: both; } .u6d2872611d58eaf25f23004868dbd910 { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u6d2872611d58eaf25f23004868dbd910:active , .u6d2872611d58eaf25f23004868dbd910:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u6d2872611d58eaf25f23004868dbd910 .centered-text-area { width: 100%; position: relative; } .u6d2872611d58eaf25f23004868dbd910 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u6d2872611d58eaf25f23004868dbd910 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u6d2872611d58eaf25f23004868dbd910 .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u6d2872611d58eaf25f23004868dbd910:hover .ctaButton { background-color: #E67E22!important; } .u6d2872611d58eaf25f23004868dbd910 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u6d2872611d58eaf25f23004868dbd910 .u6d2872611d58eaf25f23004868dbd910-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u6d2872611d58eaf25f23004868dbd910:after { content: ""; display: block; clear: both; } 了解更多如何在Linux Fedora,CentOS和RedHat中安装Mariadb / Mysql Server?

翻译自: https://www.poftut.com/mysql-default-port-number/

mysql默认端口号

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。