What is the listen port network interface for MySQL and how can you change it?

Port Number

The port number for MySQL is TCP port 3306.

See where it’s listening

How can you see if it’s listening on more than localhost (127.0.0.1)?

root@server01:~# netstat -tuln | grep 3306
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN     

Change Listening Port

Change bind-address in my.cnf or with Maria DB look harder:

/etc/mysql# mc -e mariadb.conf.d/50-server.cnf

What the output must show post change? The 127.0.0.1 must be gone.

# netstat -tuln | grep 3306
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN

Check the version

root@server01:/etc/mysql# mysql -V
mysql  Ver 15.1 Distrib 10.3.38-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Restart the service

How to restart the service after changing the listen?

root@server01:/etc/mysql# service mysqld restart

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top