Fix handling of 127.0.0.1 instead of localhost for *sql plugins

The mysql and postgresql plugins have special handling if you
use localhost as your hostname.  Sometimes you need to use 127.0.0.1
instead and want to not have that make changes to the hostname
for the metrics.