Web Hosting Talk







View Full Version : Allow access to external database?


forcerr
04-01-2010, 07:26 AM
I have a database on 1 web hosting account.

Is it possible to pull information from this on another web hosting account?

The good news is they are both on the same server and i own the server so if it's possible i do have full access.

The PHP script resides on the account without the database. how can i connect to the database on the other account..

thanks.

Dark Light
04-01-2010, 07:32 AM
Use the other accounts database credentials to login, or alternatively create new database credentials for that database and give them to your PHP script.

forcerr
04-01-2010, 07:38 AM
yes, i'm just not sure how to make a connection.


Warning: mysql_connect() [function.mysql-connect]: Host 'XX.XX.XX.XX' is not allowed to connect to this MySQL server in /home/buzz/public_html/db.php on line 2
Not connected : Host 'XX.XX.XX.XX.XX' is not allowed to connect to this MySQL server

Dark Light
04-01-2010, 07:52 AM
Fair enough. You will need to use the MySQL GRANT command on the command line to grant a user access to the database from your x.x.x.x host.

If you are unsure of how to do this, please see here: http://dev.mysql.com/doc/refman/5.1/en/grant.html