Strangest MySQL connection problem!

Hi,

I have a few different web sites on a server, called
netdive.com

I have a few different web sites on a server, called
server1.anoox.com

I am able to connect to the MySQL DB that is on server1.anoox.com
Ok
from Php pages of netdive.com but when I try to connect to the same DB with the same MySQL Connection command from another
Web site of netdive.com, it will not connect and will give me this Error message:

SELECT command denied to user 'root'@'server1.netdive.com' for table 'articles' 

What the HEK is going on? I am using the SAME EXACT MySQL Connection command!!!

Regards,

Do both PHP and MySQL reside on the same server?

The problem probably lies in the permissions the server has.

Each database and each table can have each own permissions set, using the GRANT statement.
Now, what is usally done is something like this

GRANT ALL PERMISSIONS ON some_database TO some_user@localhost … (etc, not relevant)

The problem lies in the @localhost part.
When you connect from the code running on netdive.com to the DB on netdive.com, you are connecting from the server to itself, using localhost, so the grant is accepted, but when you connect from server1.anoox.com you’re not connecting from localhost, and therefore don’t have the permissions connections from localhost have.

We have many different servers.
2 of these servers are the ones that I mentioned.
Both these servers host many different web sites.
Both these servers have Php and MySQL DBs on them.
So I am able to connect from xyz.com that is on x1 server to the MySQL that is on s2 server.
However strangely I am not able to connect from yyy.com that is on x1 server to the MySQL that is on s2 server.

Hi,

This cannot be the problem, since again I am able to connect from netdive.com server to MySQL on server1.anoox.com from Php pages that are loading from netdive.com web site, however I am not able to connect to MySQL on server1.anoox.com from Php pages that is on another web site that is on the same server that also hosts netdive.com