What Is the Default MySQL Port Number?


MySQL uses port number 3306 by default.

3306 Port Number

3306 port number is used by MySQL protocol to connect with the MySQL clients and utilities such as ‘mysqldump’. It is a TCP, i.e Transmission Control Protocol.

Vulnerabilities

Let us see if there are any vulnerabilities while using this default port −

In general, port 3306 shouldn’t be opened since it could make the server vulnerable to attack. If the user needs to connect to the database remotely, there are many other secure options, instead of opening the port 3306.

One of the secure options includes using an SSH tunnel. On the other hand, if it is required to open port 3306, the user has to ensure to restrict the IP addresses which can access it so that the connection can’t be accessed by untrusted hosts. Even though MySQL default port is 3306, it doesn’t necessarily mean that MySQL service will always use that port.

If the user wants to verify the port or see if MySQL is using a different port, it can be done by running a short SQL query.

SHOW VARIABLES WHERE Variable_name = 'port';

Updated on: 10-Mar-2021

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements