For Big Sur and later:
sudo lsof -i -P | grep LISTEN | grep :$PORT
Where $PORT is the port you are looking for. Ex: 3306
For Big Sur and later:
sudo lsof -i -P | grep LISTEN | grep :$PORT
Where $PORT is the port you are looking for. Ex: 3306