0

I am trying to connect to MySQL database at on host (DBhost) from another host (PROGRAMhost).

While I try to connect to the database at DBhost from DBhost itself the next is working fine for me:
mysql_connect("localhost","qdbname","dbpassword")

Now I am trying to find out what to use instead of localhost? I tried to replace localhost with host's url:port (I tried number of ports) but this is not working (even when I am connecting from DBhost itself). How can I find out what is the proper value to use instead of localhost?

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by rch1231
0

sounds like your hostname is not being resolved through the DNS. Have you tried using an IP address to see if thats the problem? If you can't connect using an ip address then something (firewall?) is blocking the connection.

If you're on windows machines you can edit hour hosts file and get the name resolution there. \windows\system32\drivers\etc\hosts and just map ip address to hostname with something like 192.168.1.210 database_server. BTW, this is where the name localhost is defined on your system.

0

Give just your IP address of the system you connecting.

mysql_connect("192.0.22.2","qdbname","dbpassword")

In that system phpAdmin should configured

0

Hello,

You also need to add a user to the mysql users table that connects from the remote IP. (i.e. dbuser@192.169.1.2 ) to tell mysql it is ok to accept connections from that host as that user to the specified database.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.