Learn which ports are used by default for mysqld, ndb_mgmd, and ndbd/ndbmtd. It will also be discussed how to change the default settings.
The MySQL Server – mysqld
The MySQL server (mysqld) uses port 3306 by default, but it can be configured to use any available port by setting the port option in the MySQL configuration file (my.cnf or my.ini) in the [mysqld] section:
[mysqld] port = 4406
The Cluster Management Node – ndb_mgmd
The Cluster management node (ndb_mgmd) uses port 1186 by default, but it is possible to configure it to any available port by using the PortNumber option in the Cluster configuration file (config.ini):
[ndb_mgmd] PortNumber = 1286
Alternatively the option can be set in the [ndb_mgmd default] section to apply it to all management nodes.
The Data Nodes – ndbd/ndbmtd
For the data nodes (ndbd/ndbmtd) the default is for the port numbers to be dynamically allocated. It is however possible to configure the port used with the ServerPort configuration setting like:
[ndbd] ServerPort = 11100
Which Ports are Currently Used?
On several platforms, you can see which ports are used by MySQL Server and MySQL Cluster at any given time by using the netstat command. Below is an example on Linux with one management node, two data nodes, and one mysqld API node is running on the same server:
$ sudo netstat --listening --numeric --programs | grep '\bLISTEN\b' | grep -E '/ndb|/mysqld' tcp 0 0 127.0.0.1:11100 0.0.0.0:* LISTEN 20055/ndbd tcp 0 0 127.0.0.1:11200 0.0.0.0:* LISTEN 20095/ndbd tcp 0 0 0.0.0.0:1186 0.0.0.0:* LISTEN 20040/ndb_mgmd tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 5934/mysqld
See the platform-specific documentation for netstat to see which options are available.