mysql默认端口号_什么是MySQL默认端口号?
mysql默認端口號
MySQL is very popular database in the opensource community. While developing applications or connecting MySQL database we need to specify the MySQL port implicitly or explicitly. In this tutorial we will learn MySQL default port number and alternative port numbers.
MySQL是開源社區(qū)中非常流行的數據庫。 在開發(fā)應用程序或連接MySQL數據庫時,我們需要隱式或顯式指定MySQL端口。 在本教程中,我們將學習MySQL默認端口號和備用端口號。
TCP 3306 (TCP 3306)
The default port for the MySQL service is TCP 3306. This port can be also used for MariaDB database server.
MySQL服務的默認端口是TCP3306。該端口也可用于MariaDB數據庫服務器。
使用netstat命令列出 (List with netstat Command)
We can use netstat command in order to list MySQL/MariaDB database server port number.
我們可以使用netstat命令來列出MySQL / MariaDB數據庫服務器端口號。
$ sudo netstat -p -l -n | grep mysql List with netstat Command使用netstat命令列出We can see from output that port 3306 port is listening on the local interface 127.0.0.1
從輸出中我們可以看到端口3306端口正在本地接口127.0.0.1上偵聽
For MariaDB change grep mysql with grep mariadb
對于MariaDB,使用grep mariadb更改grep mysql
從數據庫配置文件查找 (Find From DB Config File)
What if MySQL server default port is different from 3306?. We have some options. One of them is looking to the application database config file. We can get the port number from there. In this example the port number 3307?is specified explicitly.
如果MySQL服務器的默認端口與3306不同,該怎么辦。 我們有一些選擇。 其中之一是尋找應用程序數據庫配置文件。 我們可以從那里獲取端口號。 在此示例中,端口號3307被明確指定。
$link = mysql_connect('poftut.com:3307', 'mysql_user', 'mysql_password');通過Nmap掃描查找 (Find By Nmap Scan)
If we had no clue about the port number we can use some security network scanning tool named nmap. We can scan popular or all port on the host and find MySQL service. Following command will scan top used 1000 ports.
如果我們不知道端口號,可以使用一些名為nmap安全網絡掃描工具。 我們可以掃描主機上的常用端口或所有端口,然后找到MySQL服務。 以下命令將掃描使用最多的1000個端口。
$ nmap -sC -sV 192.168.1.10OR we can scan all ports of the given host.
或者我們可以掃描給定主機的所有端口。
$ nmap -p- -sC -sV 192.168.1.10使用SQL查詢查找 (Find with SQL Query)
Configuration parameter of the MySQL or MariaDB Database server is stored in the variables too. We can use some SQL inorder to print the port information from environment variables like below.
MySQL或MariaDB數據庫服務器的配置參數也存儲在變量中。 我們可以使用一些SQL命令來從以下環(huán)境變量中打印端口信息。
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默認端口號
總結
以上是生活随笔為你收集整理的mysql默认端口号_什么是MySQL默认端口号?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: centos下修改mysql默认端口_c
- 下一篇: Mysql 关联查询 索引失效