Jump to content

Remote DB connection


stualk

Recommended Posts

You've probably been asked his a million times but I was just wondering how best to connect to a db remotely (i.e. the site is hosted on one server, the db is on a different server). I've tried using the IP address, mysql.domain.co.uk, www.domain.co.uk but I keep getting the same old errors of being unable to connect.

 

Do you think it could be because my mysql server won't allow remote db connections?

Link to comment
https://forums.phpfreaks.com/topic/38138-remote-db-connection/
Share on other sites

Its quite possible. It depends who is providing the service. If you get your mysql server and web hosting from the same company then you shouldnt have any problems obviously.

There arent many ways you can go wrong with the mysql_connect() function so unfortunately if its not working, chances are its a permissions problem.

 

I have a remote database server with my hosting company, and it just works like this

$db_identifier=mysql_connect('mysql3.domain.net', 'db_user', 'db_pass')

 

I have also seen some domains require that you specify the addresses that will be used to connect to the database (usually through some form of cPanel interface) so if you have a control panel that includes database settings, look for something like this, where you can specify the hostname of the server that your website is being hosted on

 

Best to contact the person providing your database server.

 

Hope this helps

Link to comment
https://forums.phpfreaks.com/topic/38138-remote-db-connection/#findComment-182656
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.