Jump to content
Larry Ullman's Book Forums

Php Scripts To Connect To Mysql On Remote A Server

Recommended Posts

Hi everyone,


I refer to my message in my other post some time ago:

"Currently I am playing with accessing database of a remote database server from another website - so far things are in progress! (It was a complicated process in the beginning - I will share my experience sometime when my time is more flexible. Reference in book: Page 351, Tips item #2.)"


Page 351, Tips item #2 in Larry's book says:

The localhost value is used as the hose name when both the PHP script and the MySQL database reside on the same computer. You can use PHP to connect to a MySQL database running on a remote server by changing the host name in the PHP script and creating the proper permissions in MySQL.


Note that in fact "and creating the proper permissions in MySQL" is a critical part in a setup process - and the permissions have to be obtained from the server host of the remote MySQL database.


In my case, I have accounts of two sites that are hosted by two different companies. I wanted to set up a database on one site but wanted it to be accessible from scripts on both sites. Doing whatever modifications with the scripts on the site that does not hold the database will not make the scripts work with the remote database.


Permissions must be obtained from the hosting company who hosts the database server before the scripts on the remote site to be workable. The "permission" is some configuration the host has to adjust on their server, and has nothing to do with the scripts (other than the access info as mentioned in the book).


Hope this info is helpful to other 'newbies' like me ^_^


Have a great day!



Link to comment
Share on other sites


  • Create New...