I have server1 with a mysql database and working php website. I also have a new server2 with most of the php files and it should connect to mysql db on server1 to get all of its data. The new user I made for this on the mysql db has "%" as host and all needed global priveleges as far as I can tell. But its not working.

This is how I connect :

mysql_connect("", "server2", "somepassword");

And I always get this error :

Warning: mysql_connect(): Can't connect to MySQL server on '' (111)

Now I changed a lot of settings already, I tried different host values, new users, different priveleges, all ip's of the server or the websites on it... but always the same error. The port number is standard so should be ok too. So I assume that there's nothing wrong with the user settings or the code itself, and that the problem must be somewhere else. But I cant imagine what more that could go wrong here.... Maybe server1 is blocking all incoming connections or something like that ?

Can anyone give me some directions on how to find the problem and how I might solve it ?