0

please tell me how to connect to a database which is on other machine on same network.
i have two machines, client and server.
server is asking questions and client is responding with one of four options.
i have an answer table at server side, and i want it to automatically update the count as response from client is available.
plz give me some suggestions.

5
Contributors
4
Replies
29
Views
3 Years
Discussion Span
Last Post by sktthemes
0

The 'website' and DB are on the (same) server right?

You access the 'website' from another machine - OK.

It's still your server that accesses the DB - the client is just that - it tells the server to query the DB and then the server sends the info to the client.

Show your code if you need help with it.

0

Hello,

This answer is if your web site is on one server and the database is on another and your database is in MySQL.
What you need to do is to create a login to mysql for the <database user>@<the server you are requesting the data from>.

For example:
Lets say your web server is at 10.0.0.5 and the database server is at 10.0.0.10
And the user that you want to access the database with is called dbuser then in MySQL now you probably have a user like this:
dbuser@localhost

You need a user like this:
dbuser@10.0.0.5

with the same privledges as the original user.

The sql code to add this user would be:

USE mysql;
CREATE USER 'dbuser'@'10.0.0.5' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON <database>.* TO 'dbuser'@'10.0.0.5'
WITH GRANT OPTION;

Where <database> is the actual name of the database you want them to have access to.

0

If you want to mysql connection on serverside as well as clint side both connnections are same,I think your not include connection files in serverside scripting means config file also inlcude in your header.Then check againg your problem will be solved.

Just include your connection files in Header.

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.