RON_ron Posted July 5, 2010 Share Posted July 5, 2010 The MySQL database is at server A. I need to access it from server B. How do I access data while being in server B? Please help me write this code. (I beleive the IP address is used here.) $link = mysql_connect("http://111.262.33.44/cpanel/","my_username","my_pw"); mysql_select_db("my_database"); Quote Link to comment https://forums.phpfreaks.com/topic/206761-localhost/ Share on other sites More sharing options...
trq Posted July 5, 2010 Share Posted July 5, 2010 Firstly, MySql does not use the http protocol so you can remove all that. Its a hostname (or ip address), not a url, there is a big difference. You also need to make sure that the user account on server B has permissions (on server A) to connect to your database from server B. This is all covered within the MySql manual. http://dev.mysql.com/doc/refman/5.1/en/adding-users.html Quote Link to comment https://forums.phpfreaks.com/topic/206761-localhost/#findComment-1081273 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.