rameshfaj Posted January 18, 2008 Share Posted January 18, 2008 How can i connect to the remote database server using PHP code,assuming that the remote server has default Mysql configuration.I have done like this: <?php mysql_connect("IP:PORT","username","password"); //where the paramters are only format not real values ?> The error is like this: Couldnot connect to the database.... Quote Link to comment https://forums.phpfreaks.com/topic/86605-connecting-the-remote-database-server/ Share on other sites More sharing options...
timmah1 Posted January 18, 2008 Share Posted January 18, 2008 Not sure if I'm right, but did you try taking the PORT out? I just remember reading somewhere that not all require the PORT Quote Link to comment https://forums.phpfreaks.com/topic/86605-connecting-the-remote-database-server/#findComment-442528 Share on other sites More sharing options...
revraz Posted January 18, 2008 Share Posted January 18, 2008 You need to specify the database as well. mysql_select_db("databasename"); Quote Link to comment https://forums.phpfreaks.com/topic/86605-connecting-the-remote-database-server/#findComment-442529 Share on other sites More sharing options...
trq Posted January 18, 2008 Share Posted January 18, 2008 It simply won't work with the default mysql configuration. You need to allow your username to connect from a specified remote ip address/domain name, or if you really like living on the edge you can enable a connection from any ip/domain. mysql> GRANT ALL PRIVILEGES ON *.* TO 'yourname'@'your.ip.goes.here' IDENTIFIED BY 'yourpass' WITH GRANT OPTION; Quote Link to comment https://forums.phpfreaks.com/topic/86605-connecting-the-remote-database-server/#findComment-442533 Share on other sites More sharing options...
roshanbh Posted January 18, 2008 Share Posted January 18, 2008 to connect to the remote server you must have the permission from remote server. Please check the permission as well. http://roshanbh.com.np Quote Link to comment https://forums.phpfreaks.com/topic/86605-connecting-the-remote-database-server/#findComment-442545 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.