mysql默认端口号_什么是MySQL默认端口号?

mysql默认端口号_什么是MySQL默认端口号?mysql 默认端口号 MySQLisveryp Whiledevelop Inthistut

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是开源社区中非常流行的数据库。 在开发应用程序或连接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
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.10 

OR 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命令来从以下环境变量中打印端口信息。

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

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

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

LEARN MORE  How to Install Mariadb / Mysql Server in Linux Fedora, CentOS and RedHat?

了解更多如何在Linux Fedora,CentOS和RedHat中安装Mariadb / Mysql Server?

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

mysql默认端口号

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/231620.html原文链接:https://javaforall.net

(0)
上一篇 2025年12月1日 下午12:01
下一篇 2025年12月1日 下午12:22


相关推荐

  • C 中怎么将string转换成int型

    C 中怎么将string转换成int型intintA 0 1 intA int Parse str 2 int TryParse str outintA 3 intA Convert ToInt32 str 以上都可以 其中 1 和 3 需要 try 异常 2 不需要 nbsp TryParse Usage1 intnumber boolresult Int32 TryParse value outnu

    2026年3月20日
    2
  • 大数据采集技术概述「建议收藏」

    大数据采集技术概述「建议收藏」大数据采集是指从传感器和智能设备、企业在线系统、企业离线系统、社交网络和互联网平台等获取数据的过程。数据包括RFID数据、传感器数据、用户行为数据、社交网络交互数据及移动互联网数据等各种类型的结构化、半结构化及非结构化的海量数据。不但数据源的种类多,数据的类型繁杂,数据量大,并且产生的速度快,传统的数据采集方法完全无法胜任。所以,大数据采集技术面临着许多技术挑战,一方面需要保证数据…

    2022年6月24日
    48
  • rsync @ERROR: auth failed on module backup 错误分析及解决[通俗易懂]

    rsync @ERROR: auth failed on module backup 错误分析及解决[通俗易懂]今天搭配rsync–daemon守护模式,服务搭配起来不是很复杂,比较简单,配置如下:首先检查#rpm–qarsync是否有安装rsync软件,如若没有的话,请执行yuminstall–yrsync;1.新建守护模式的配置文件:/etc/rsyncd.conf…

    2022年7月15日
    20
  • Flutter 使用插件打开相册、相机「建议收藏」

    Flutter 使用插件打开相册、相机「建议收藏」需求:image_picker的使用,点击按钮底部弹出相册、拍照选择框,实现具体功能1:引入插件pubspec.yaml增加image_picker:^0.7.5+22:android添加androidx兼容gradle.properties增加android.useAndroidX=trueandroid.enableJetifier=truebuild添加依赖androidTestImplementation’androidx.tes…

    2025年11月30日
    7
  • 场景管理,放弃场景图

    场景管理,放弃场景图场景图一直被认为是适合游戏的通用场景管理算法 仿佛没实现过场景图就不算写过引擎 但是经过思考和分析 我觉得场景图并不适合作为一种通用的场景组织方式 在下面我会说明理由 并提出一种替代的适合目前 mmorpg 网游的场景管理方式 如果大家有什么不同看法可以和我讨论 nbsp nbsp nbsp 场景图是一种层级组织场景的数据结构 要生成场景图就要选择一种层级关系 或曰父子关系 或曰继承关系 比如几何变换矩阵的

    2026年3月16日
    2
  • Latex插入图片设置参数

    Latex插入图片设置参数图片位置命令作用h此处(heret页顶(top)b页底(bottom)p独立一页(page)

    2022年5月27日
    34

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号