Bootstrap FreeKB - mySQL / MariaDB - port (3306)
mySQL / MariaDB - port (3306)

Updated:   |  mySQL / MariaDB articles

By default, mySQL and MariaDB will communicate over port 3306.

If you have one or more firewalls between the client that wants to connect to mySQL or MariaDB and the system running mySQL or MariaDB, the port being used by mySQL or MariaDB will need to be opened/allowed in each firewall. For example, if firewalld sits between the client and mySQL or MariaDB system, and mySQL or MariaDB are using the default port 3306, here is how you would allow port 3306 in firewalld.

firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --reload

 

To determine if mySQL or MariaDB are using default port 3306 or some other port, and mySQL or MariaDB is running on a Linux system, issue this command to determine the primary configuration file being used by mySQL or MariaDB. In this example, /etc/my.cnf is the primary configuration file being used by mySQL or MariaDB.

~]# mysql --help | grep /my.cnf | xargs ls
ls: cannot access /etc/mysql/my.cnf: No such file or directory
ls: cannot access /usr/etc/my.cnf: No such file or directory
ls: cannot access ~/.my.cnf: No such file or directory
/etc/my.cnf

 

Check the primary configuration file for the following directive. If the primary configuration file does not have the port directive, then default port 3306 is being used.

port = 3306

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 42d2a3 in the box below so that we can be sure you are a human.