Page 1 of 1

What service is using this port?

Posted: Sat Dec 31, 2016 9:29 am
by kardo
I'm using Linux Mint 17.1, 64-bit.

Still very much new to it as I've not dabbled much in the Terminal and have been finding things in these forums and online to muddle my way through. But after hours trying to figure this one out, it still has me stumped.

It looks like something else, which I can't identify, is using port 3306, which I need for a new install of LAMPP.

Tried doing it quite a few months back, it didn't work, and back then I didn't need it badly enough to spend the time trying to figure out why. In another user account, I installed it again today but MariaDB (which apparently replaces MySQL, although the terminology seems almost interchangeable) won't start.

The error log gives me this:

2016-12-31 20:43:05 139998375688064 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 98: Address already in use
2016-12-31 20:43:05 139998375688064 [ERROR] Do you already have another mysqld server running on port: 3306 ?

In the Terminal, I used $ sudo netstat -tunap | grep LISTEN to produce this output:

tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 880/smbd
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN 1652/dnsmasq
tcp 0 0 127.0.0.1:4822 0.0.0.0:* LISTEN 2264/guacd
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 1580/postgres
tcp 0 0 0.0.0.0:538 0.0.0.0:* LISTEN 2246/gdomap
tcp 0 0 0.0.0.0:17500 0.0.0.0:* LISTEN 2393/dropbox
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 880/smbd
tcp 0 0 127.0.0.1:17600 0.0.0.0:* LISTEN 2393/dropbox
tcp 0 0 127.0.0.1:17603 0.0.0.0:* LISTEN 2393/dropbox
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 12450/mysqld
tcp6 0 0 :::139 :::* LISTEN 880/smbd
tcp6 0 0 :::17500 :::* LISTEN 2393/dropbox
tcp6 0 0 :::445 :::* LISTEN 880/smbd

The port I need is there, 4 lines from the bottom, but it's not LAMPP using it because MySQL/MariaDB was already stopped.

I have uninstalled and re-installed repeatedly, restarted the computer, same result. In case I've been doing that wrong and making things worse, the command I've been using to uninstall is:
sudo rm -rf /opt/lampp

I have no idea how to identify the service that is using typing up port 3306. Is there a way to find this out? (and then I can do something about stopping it!)

My apologies for the bad formatting of the quoted stuff, this is only my 2nd ever post, but I will be grateful for any help I can get.

Re: What service is using this port?

Posted: Sat Dec 31, 2016 10:16 am
by richyrich
I can't help with the ports, but this is NOT the way to un-install anything . . all this command does is delete !
sudo rm -rf /opt/lampp

Re: What service is using this port?

Posted: Sat Dec 31, 2016 10:30 am
by fungus
3306 is usually a MySQL port.

EDIT: In a terminal try to "kill mysqld" and see if the port is still in use. In order to completely rid yourself of MySQL you should purge packages "mysql-client", "mysql-server" and "mysql-common".

Re: What service is using this port?

Posted: Sat Dec 31, 2016 10:53 am
by kardo
@fungus, when I try "kill mysqld" I get this:

bash: kill: mysqld: arguments must be process or job IDs

Re: What service is using this port?

Posted: Sat Dec 31, 2016 11:06 am
by fungus
kardo wrote:@fungus, when I try "kill mysqld" I get this:

bash: kill: mysqld: arguments must be process or job IDs
Sorry, you need the process ID of mysqld (ps -A | grep mysqld) - the first column holds the process ID which can be used to kill the process :)

Re: What service is using this port?

Posted: Sat Dec 31, 2016 11:54 am
by kardo
thank you, that did it! Looks like it's all working the way it should.

[Edit] That was yesterday. Today, after restarting my computer, it's misbehaving again. :(

I keep using the "kill" command, but each time, a fresh process ties up the port. Even after I shut down everything on my screen except the one terminal, where I'm putting in the commands to identify the process and kill it, it comes up with a fresh process using the port.