Where are all the MySQL(and postgresql) servers?

What if you are new to a network, and want to look smart?
One way to do that is to know the network before someone tells you. It is also good to know if there are rouge servers out there that should have the port shut off.

I like to use nmap to do this. According to the man, nmap is:

Network exploration tool and security / port scanner

Without fluff, here are the steps:

  1. Determine your IP range. Are you in a 192.x.x.x or 10.100.x.x?
  2. either use command line, or download the gui if your are in windows.
  3. run this:  nmap 10.100.0-255.0-255 -p 3306

What you’ll end up with is a long list of IPs it checked, along with those with open 3306 (default mysql).
I know what your next question is: what if MySQL is using a different port? Well? Then you’re just weird.
Of course if you want to find other services like PostgreSQL use port 5432
AND if you want to list all your services do something like this:
service –status-all | more
or
service –status-all | less
or
service –status-all > somefile.txt
Super cool:
Run this:
nmap 10.0-255.0-255.0-255 -sV  -p 3306 >network
and it will also give you the version of MySQL

Posted in Linux, MySQL

Leave a Reply