Thread:Manual talk:FAQ/set up database on a different server

I am trying to use a different server as database server for mediawiki. When I set it up, I put the ip address of that server (128.148.16.166) and the setting page threw a DB connection error. Then I tried to put the database on the same server(128.148.16.167). It still gives me error when I put ip address in the settings, while it works if I just type in "localhost". I cannot figure out why is this. I thought "localhost" should be exactly the same thing as "128.148.16.167". What should I do to fix it so that I can use a different server as database.