Zach Smith
Zach Smith

Reputation: 5704

Website Here, Linking to Database There on other Server?

Is it possible to link to a MySql database that is on another server and hosted somewhere else entirely?

Upvotes: 1

Views: 171

Answers (11)

winwaed
winwaed

Reputation: 7829

Definitely - and that is how my web host implements MySQL databases: As soon you create one it is created in a cluster of servers. Along with username&password pairs, and database name, they give you the server name.

Similarly, you can do it on your own LAN, or even over the Internet. I've done it over a LAN for testing. I would not recommend doing it over the Internet though due to very slow speed and an increase in security risk.

Upvotes: 0

Dotty
Dotty

Reputation:

I've been trying this for days with a joomla site and can't get it to connect to a remote DB. The db is configured to be accessible from all hosts but given that joomla has a config file that specifies seperately the host, DB name, username and pass (you can't create a connection string manually) I'm not sure what other options I have to get this to work.

Did the orginal poster have success with this?

Upvotes: 0

Philippe Carriere
Philippe Carriere

Reputation: 3720

I have to recommend against it if you have a lot a data to transfer via the web, but within the network of company it works. In fact, in a common solution : you put the data on a dedicated server with performance/redundancy capabilites.

When you can connect to a local database you use a connection string such as 127.0.0.1:3306/somthing_something. With that in mind, you realise you can easily change this to another host.

Upvotes: 1

riotera
riotera

Reputation: 1613

It is possible if the hosted MySql server has a public IP you can access.

Upvotes: 0

smok1
smok1

Reputation: 2950

Yes, it is possible, but it is not wise solution, since your users will experience additional lags when your application will be connecting to some distant database.

Upvotes: 0

Prof. Frink
Prof. Frink

Reputation: 11

Yes - Check out connection strings http://www.connectionstrings.com/mysql

Upvotes: 1

joeslice
joeslice

Reputation: 3464

Certainly. The most common production deployment has the database hosted on a seperate server. What might be interesting to you is the connection string that you application defines.

Upvotes: 0

Sergio
Sergio

Reputation: 8269

yes, just change the host configuration on your connection string

http://www.connectionstrings.com/mysql

Upvotes: 2

Robin Day
Robin Day

Reputation: 102538

yes, however, performance (bandwidth, latency) may be an issue depending on your specific requirements

Upvotes: 0

Josh Stodola
Josh Stodola

Reputation: 82513

Yes, you can connect to a remote server.

How to Enable Remote Access To MySQL Database Server

Upvotes: 1

Michael Todd
Michael Todd

Reputation: 17071

Yes, as long as a path is provided to you to get "at" the MySql server. In other words, the person hosting the SQL server would have to ensure that a port is open on their firewall so that your application could talk to it.

Upvotes: 0

Related Questions