Forum Moderators: phranque

Message Too Old, No Replies

localhost with external mysql

localhost with external mysql

         

jordeneo

7:40 pm on Nov 14, 2005 (gmt 0)



hello, here is my scenario, i have set up apache and php on my machine, working great as a localhost setup, but here is the tricky bit, i need to connect to an external mysql database server as this is where all the information is stored, how do i configure this?

The mysql connection work fine if i upload to a php server, but i need to get it working of my own machine. can anyone shed wisdom on this?

coopster

8:50 pm on Nov 14, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You can connect to an external MySQL database from your own machine. You would need to have the external database setup with the correct permissions to allow remote connections and then in your PHP mysql_connnect [php.net] function you specify the IP of the remote MySQL server.

It would be much easier though just to replicate the database on your local configuration if it is merely a development box.

jecasc

2:18 pm on Nov 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Most hosting companies have set the databases permission to not allow access from external sites for security reason. You could ask your hosting company to change the permission. But if you are on a virtual server and share the server with others they usually won't allow it.

If the permission is set correctly there is no special trick. Simply enter the database details into you configuration file and off you go.