English
+370 5 205 5502 sales@monovm.com

What are MySQL Port Numbers? [Default MySQL Port]

Are you looking to know more about MySQL Port Numbers along with the default MySQL Port Number? This blog post will help you with the various port number of MySQL.

03 Jun, 22 by Susith Nonis 6 min Read

List of content you will read in this article:

MySQL is a database management system used in a network to add, access, and process the data stored in a database. To connect directly or access your MySQL database or connect a different application to the database, you should have information such as the MySQL port number. 

For your database, the default MySQL port number is 3306, While most applications will set the port number by default, in other cases, it may change. The port number may also change for security purposes. It may also change because another application is already using the database port number. 

The MySQL protocol uses the default port to connect to utilities such as 'mysqldump' and MySQL clients.

Are there vulnerabilities when using the port?

When the default port 3306 is opened, the MySQL server is vulnerable to attacks. Thus, the user has to explore other secure options if they want to access the database remotely. 

Instead of opening the 3306 MySQL port, consider options like an SSH tunnel. The other option is restricting the IP addresses that can access the port to prevent connection by suspicious hosts. While the default port is 3306, it doesn't mean that MySQL will always use it. Running a short SQL query can help you identify the port your MySQL is running on.

There is a wide range of ports used by MySQL features. They include:

1. Client-Server connection ports

Port 3306 is the default port used by the MySQL client, utilities like mysqldump, and MySQL connectors. It is also the default port for classic MySQL protocol. The protocol is supported by clients like MySQL router, MySQL Shell, and MySQL connectors.

2. MySQL Administrative Connection Port

The MySQL server allows TCP/IP port configuration for administrative connections. This port increases the options for administrative connections allowed on the network interface for ordinary connections.

3. MySQL Shell Ports

MySQL shell is an advanced code and client editor. MySQL shell also supports both the classic MySQL and X Protocol.

Other ports include the high availability ports, key management ports, MySQL Workbench ports, Memcached Protocol ports, and external authentication ports.

You might find that one to even ten ports are used in your MySQL ecosystem. The port in use is essentially determined by the components in use, what has been enabled, how your apps connect, and the general characteristics of the MySQL environment.

The ideal way to use the ports is to make them wide enough to accommodate the different components while at the same time blocking out untrustworthy hosts.

There are several ways to establish the port your MySQL server is listening to. If you are connected to your MySQL server, you can run the query "show variables where variable name in ('hostname,' 'port')."

If you are using Windows, you can check the MySQL port number in the configuration file. 

Here are the steps.

  1. Go to "my.ini file"
  2. Open the "Services" window and find properties then you will find the location of the my.ini file.
  3. Open the .ini file

After finding the file's location, find the MySQL port that is listening in Windows.

Changing your default MySQL port can protect you from unauthorized access through brute-force scripts. While non-standard ports may enhance your security, it only does so by extending the time it takes for successful hacking to go through. Therefore, it would help if you had other security measures in place.

The other reason you may require a port change is if the standard 3306 is busy.

You can change the port number of your MySQL server by using the below-listed steps.

  1. Open the "my.ini" file in the MySQL installation directory
  2. You will see the port with the default number 3306
  3. Change the port number 3306 to your desired number
  4. Save the changes so that the "my.ini" file is saved
  5. Restart your MySQL server so that it picks the changes.

You can then open the "my.ini" file in the server's installation directory. The moment you restart MySQL, it will start listening to the new port number.

MySQL Port awareness is critical as it helps you understand when they will be used.

1. Port 3306/TCP

The default port 3306 connects MySQL clients to the MySQL server. The communication on this port is also encrypted by default. The direction of communication on this port is from the client to the server and is required unless X protocol is used.

2. Port 33060/TCP

Communication from this port is from the MySQL client to the server, and the communication is also encrypted. The port is also necessary for communication unless the default 3306 is being used. 

3. Port 33062/TCP (default)

The communication on the port is from the client to the server and is also encrypted. Note that this MySQL port is particularly configured to support the administrative connections. The administrative interface of MySQL makes it for operations like the administration of users, configuration of servers, viewing logs, and exports and imports. 

4. Port 33061/TCP

33061/TCP alongside 33060/TCP and 3306/TCP are categorized as shell ports. Port 33061/TCP is required for running InnoDB Cluster. The communication on the port is also encrypted. The port's key role is to check a server during the configuration of the InnoDB Cluster.

5. Port 22/TCP

MySQL workbench integrates administration, database design, maintenance, creation, and SQL development. The visual database design tool integrates all the said elements into a single development environment in the database system. 

Port 22/TCP is a workbench port with the direction of communication being from the MySQL workbench to the server. Communication rides on connection through an SSH tunnel. 

Being aware of the different MySQL ports is important. You need to understand them in terms of what they are, what uses them when the ports should be used, level of security in terms of encryption and access limitations. these are the best information that we have given about MySQL ports, default MySQL ports, and various port no of MySQL. suggest your feedback via below given comment box.

People also read:

Susith Nonis

I'm fascinated by the IT world and how the 1's and 0's work. While I veture into the world of Technology I try to share what I know in the simplest way possible. Not a fan of coffee, a sweet addict and a self accredited 'master chef'.