What Is MySQL Port Number?

MySQL is a popular relational database management system that is used by different applications and programming languages. An application generally uses a network and MySQL port in order to connect MySQL database and consume services in order to query, save, change records. The default MySQL port number is “3306” which is also assigned to MySQL by the IANA. This means the port number is TCP 3306 is used by MySQL officially. Also, MariaDB which is the popular fork for MySQL is using the port TCP 3306.

MySQL Port Number TCP 3306

By default, MySQL uses the port TCP 3306 as the default port for data transmission. Generally, different applications and tools like MySQL Workbench, Python Application, PHP application use the 3306 port number. Even you may see the 22, 389 they are not used for data transmission and they are used for tunneling, configuration, authentication, etc.

Which Applications Use Port 3306?

There are a lot of applications using port 3306. Below we list some of the most popular and well-known applications that use 3306 for data transmission.

  • MySQL Workbench
  • MySQL Enterprise Monitor
  • Application Server
  • MySQL Router
  • MySQL Shell

Is MySQL 3306 Secure?

In the early days of MySQL and related products, port 3306 was a clear text port which means it is not encrypted and easily readable by network sniffers. But with the recent releases of MySQL use TLS/SSL encryption in order to protect against sniffing or man-in-the-middle attacks. Also, MySQL 3306 provides authentication and authorization to secure communication. But the credentials and especially the password should be set in a complex way to prevent brute force attacks.

Show MySQL Port Number From MySQL Interactive Command Line

MySQL provides the MySQL interactive command-line interface in order to manage and run SQL queries in the server. There are different commands related to the MySQL server configuration management and the variables contain related configurations. The variables can be listed to show MySQL port numbers. By using the following command port-related configurations can be listed which are stored as Variables.

mysql> SHOW VARIABLES LIKE 'port';

Find MySQL Ports By Scanning Nmap

In some cases, we may need to find the MySQL port in the network by scanning single or multiple hosts. The nmap is a very useful tool in order to identify the MySQL port in a network by scanning single or more hosts. The following command scans the whole or hosts for port number 3306.

$ nmap -p 3306

Leave a Comment