I just setup a new DB server replacing one that has been live for 5+ years. I normally set the db connections in the host file but now that the new server is up I still see some connections to the old server how can I track down where those connections are coming from?
2 Answers
If you log into the old MySQL server and run the following:
mysql> show processlist;
You should see a list of all active connections, with the source host in the 3rd column. It should be of the form:
serverhost:12345
Where serverhost
is the hostname you're looking for and 12345
is the source port. If you want to track down the process that's connecting to MySQL, on serverhost
run the following:
serverhost# lsof -i :12345
You should get something like this:
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
program 5954 root 27u IPv4 -780315302 TCP serverhost:12345->mysqlserver:mysql (ESTABLISHED)
So in this example, command program
at PID 5954
is the offender.
Hope this helps.
You can view same informations explained by vmfarms also using Mysql Administrator (old gui) or Mysql WorkBench, into the section "Server Connections", after you login into the server as root.