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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 8.app后端和web后端的区别

    8.app后端和web后端的区别很多从web后端转到app后端的小伙伴经常很茫然,不知道这两者之间有啥区别。本文通过例子,分析web后端和app后端的区别,使各位更好地把握app后端的架构。

    2022年6月22日
    57
  • postman做模拟服务器_centos7服务器安装教程

    postman做模拟服务器_centos7服务器安装教程postman安装方式:1)浏览器插件方式安装:2)客户端安装:https://www.getpostman.com/apps使用教程:1)界面:2)利用postman发送post请求、参数是json格式3)Get方法和Post方法的区别1.get是从服务器上获取数据,post是向服务器传送数据。2.get安全性非常低,post安全性较高。但是执行效率却比Post方法好。3.POST的安全性要比…

    2025年11月19日
    7
  • C语言fscanf和fprintf函数的用法详解

    C语言fscanf和fprintf函数的用法详解fscanf()和fprintf()函数与前面使用的scanf()和printf()功能相似,都是格式化读写函数,两者的区别在于fscanf()和fprintf()的读写对象不是键盘和显示器,而是磁盘文件。这两个函数的原型为:intfscanf(FILE*fp,char*format,…);intfprintf(FILE*fp,char…

    2022年10月19日
    2
  • 无法获得下列许可 solidworks_2019年个人总结

    无法获得下列许可 solidworks_2019年个人总结通常,按照网上教程来安装SolidWorks2019、2020到最后启动软件有可能会出现这个错误;下面提供本人亲测可用、在用的解决办法供各位参考。1.如果弹出该错误提示时,先检查“SolidWorks_Flexnet_Server”这个文件夹的所在路径,建议移动到SolidWorks的安装根目录下,即“SOLIDWORKSCorp”目录下。因自身原因无法移动的,请勿删除该文件夹,否则会激活…

    2022年9月22日
    1
  • oracle维护服务 oracle解决方案 oracle售后服务

    oracle维护服务 oracle解决方案 oracle售后服务为客户提供的oracle金牌技术服务内容为:1.电话服务(7*24)热线支持电话800-810-0081每周7天,每天24小时北京技术支持中心每天都有专人值守。以保证及时与客户沟通。以最快的

    2022年8月3日
    10
  • CCBValue

    CCBValue

    2022年1月7日
    50

发表回复

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

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