You can consider the above as involving 3 ip addresses. Your ip (that is, the machine on which the browser runs), the web server ip and the database server ip. Do note that all of these might be the exact same ip address, since one single computer is capable of running a db server, a web server and a browser which can connect to the web server on the same computer (i.e. localhost or 127.0.0.1) which in turn connects to the database on the same computer. Also note that the connection from webserver to database server on the same maching doesn't have to connect via TCP/IP since it can use sockets or names pipes instead.
Now back to the part which brad referred to when he said that it has nothing to do with the db server's ip address
fxpepper;10994335 wrote:
mysql_connect() [function.mysql-connect]: Access denied for user 'password'@'1.111.22.211' (using password: YES)
To access the db server, you need to meet specific criteria, which are stored in the db. The criteria having to be met includes: username, password and ip address. YOUR ip address, not the database server's address.
Once again, if you manage to send your username and password to the db server, you obviously know how to reach it! The db server doesn't need to tell you this.
However, if you are connecting from an ip address which isn't allowed, the server has to inform you that you are not allowed to login just as if the username you are trying to login with isn't allowed. Thus, it tells you which ip you are connecting from, just like it tells you what username you were trying to connect with.
If you havn't allready understood it from the above, do note that the same combination of username and password might be allowed to connect from one or more ip addresses while being disallowed from one or more other ip addresses.
If you only use one single db user for your web stuff, that user should only ever be allowed to connect from the ip address(es) of your web server(s). Well, optionally you might just as well allow it locally (to the db server) as well.