Hello Everyone,

I have a pretty simple problem for an expert. I want to access the database on the server from my localhost, I don't know how to do it. On our localhost the way is mysql_connect("localhost","name","password");
But how I will access the database on a server from my localhost??
Please help me.

Recommended Answers

All 4 Replies

specify the IP address of the server in the place of localhost.

as long as the dns can resolve the hostname you can use the name in place of 'localhost' as well, this way if the ip ever changes it will still resolve to the correct address

Doh.. exactly I forgot to mention this which dickersonka correctly points out a name will do fine as well, as long as the DNS can resolve it.

cxn = MySQLdb.connect(host='192.168.1.13',user='root',passwd='',db='navicat')

This is how we do in Python.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.