Connecting to remote database
Moderator: General Moderators
Connecting to remote database
I'm using plesk with several domains setup, I want to have multiple domains access a database on one of the domains. I assume this would be done by using a remote connection....... has anyone done this or have any insight as to how I would do this?
I'm not sure how you go about doing this with Plesk specifically. What you need to do is set the permissions on the database to be accessible either from '%' (anywhere) or make multiple entries for each ip of each domain you're wanting to have access from. Then, when you're connecting to the DB from PHP, just connect like:
However, if all the domains are on the same server, you shouldn't need to do anything. All the domains could just connect to 'localhost' without a problem.
Update: Dang! I've been 'feyded'!
Code: Select all
$connection = mysql_connect('IP of server',$username,$password);Update: Dang! I've been 'feyded'!
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.