Well-Known Member
Mar 29, 2005
I'm trying to remotely access a mysql database on server from server

I've logged into the cPanel account on server and added to the Remote Database Access Hosts. (As well as %.domain.com where domain .com.is the actual domain on that will be accessing the database)

I'm using the same username/password that I use to access the database locally on (without any problems)

But when It try to access the database from the remote server via PHP using -
mysql_connect('', 'username', 'password');

I get the error -
Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on (4)

I know the database is running fine and I've read every post I can find on this subject, but I can't get it to work.

I'd appreciate any suggestions.


Well-Known Member
Mar 3, 2006
Since you aren't seeing the server at all according to your error message, your host is most likely running a firewall and blocking port 3306 from the open public.

They would probably grant access through the firewall if you explain your situation. If not, seek another host. I do not publicly open 3306 either but I do facilitate active client connections.

Good luck