stualk Posted January 18, 2007 Share Posted January 18, 2007 Is it possible to host a site on one server and connect to a db on another? I always thought it was possible but i'm struggling at the moment!Here's the code i'm using:[code]<?$user="username_here";$pass="password_here";$host="host_ip_address_here";$dbname="db_name_here";$connection = mysql_connect($host, $user, $pass);if (!$connection){ echo "Could not connect to database: " .mysql_error();}$founddb = mysql_select_db($dbname, $connection);if (!$founddb){ echo "Could not find DB: " .mysql_error();}?>[/code]Beside the 'host' field I've tried using the server IP address, the web address, the mysql admin address, the domain on it's own...Nothing has worked! Link to comment https://forums.phpfreaks.com/topic/34745-remote-db-connection/ Share on other sites More sharing options...
trq Posted January 18, 2007 Share Posted January 18, 2007 Have you setup the user with permissions to connect from that host within mysql? Link to comment https://forums.phpfreaks.com/topic/34745-remote-db-connection/#findComment-163781 Share on other sites More sharing options...
stualk Posted January 18, 2007 Author Share Posted January 18, 2007 I don't know how to!Is it fairly straight forward? Link to comment https://forums.phpfreaks.com/topic/34745-remote-db-connection/#findComment-163790 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.