How to connect to the MySQL database remotely

hoangvu

New member
Joined
Jun 6, 2012
Messages
1,835
Points
0
I have 2 domains in same niche and hosting domains at Godaddy and Namecheap. I want 2 these domains use just a database but on 2 different web hosting providers. I read that I need to add these lines into config file
Host name = (use the server IP address)
Database name = your_databaseName
Database username = your_databaseUsername
Database password = your_password
MySQL Connection Port = 3306
TCP or UDP, either is fine.
But I don't know how to do? any guides?
 

ulterios

New member
Joined
Nov 25, 2015
Messages
1,267
Points
0
Wow, this is very interesting. I really can't tell you how to do that but I am sure someone will ring in that knows how to do it.

The thing is that since you will be accessing a remote database from another hosting provider, that will surely make it slower since it's getting it's data remotely.

Here are a couple of guides that I found, maybe one will be able to help. Let us know how it works out.

[URLnofo]https://www.godaddy.com/help/connect-remotely-to-databases-4978[/URLnofo]

[URLnofo]https://www.namecheap.com/support/knowledgebase/article.aspx/1249/89/how-to-remotely-connect-to-mysql-database-located-on-our-shared-server[/URLnofo]

Good Luck!
 

EpicGlobalWeb

New member
Joined
Jan 24, 2016
Messages
467
Points
0
You have to allow for remote access on your server and the rest is php please pm me
 

Mike001

New member
Joined
Apr 27, 2016
Messages
578
Points
0
Oh the insanity of it all.

I am just imagining the security issues that could arise from this type of connection. One database on a Virtual shared server, connecting directly to another database on a Virtual shared server, across the internet on what I am certain will be an non-secure link.

I will be following this thread, this could get really interesting.....
 

laceibanet

New member
Joined
Feb 23, 2016
Messages
43
Points
0
a remote mysql is usually not open as it can cause a number of security issues. It's best done in a closed network, but if you are using a hosting company to host the server you can probably ask their support team about it.
Best to start with your provider as they will tell you what they can and can't allow
 

BountySite

Member
Joined
Mar 2, 2016
Messages
43
Points
8
Definite thumbs down for remote mysql unless it is over SSL, from security standpoint.
Hosting provider has more to worry about exposing mysql port to the internet.
 

SenseiSteve

Active member
Joined
Nov 11, 2015
Messages
215
Points
28
What I found interesting on GoDaddy's link was this line, "Direct database connections do not support secured (SSL) connections."
 

elcidofaguy

Well-known member
Joined
Jan 13, 2015
Messages
1,281
Points
113
The best way to do this is to set up an API e.g. REST or SOAP such as writing a PHP script which authenticates the request and then returns data in JSON or XML format. My preference would be REST API with JSON data as that works really well with JQuery GUI controls. The easiest way to do that would be to use the HTTP GET/POST methods to communicate.

If however you want to setup duplicate sites or a backup then you can setup a scheduled task to move data from one mysql database to another via SSH. Not sure why you would want to do that other than to create a backup copy.

Hope that helps!
 

ElixantTechnology

New member
Joined
Nov 26, 2014
Messages
622
Points
0
Most hosting providers, for security purposes block outside requests to the port that MySQL operates on (3306); the reason for this is for protection of the database from outside intrusion as it is a popular point for brute force attacks. It's definitely NOT recommended to use a *remote* MySQL Database; in instances where the Database Server is on a 1Gbps+ internal network with little to no hops in between the servers it is fesable, however the added response time is a real killer if trying to communicate tens of thousands of database requests a second across the country ;)
 

mellisas

New member
Joined
Sep 25, 2016
Messages
24
Points
0
For remote mysql database connectivity make sure that you are defining correct ip address in mysql hostname field and check with hosting provider that remote mysql is enabled or not on server.
 

Rob Whisonant

Moderator
Joined
May 24, 2016
Messages
2,489
Points
113
If the remote host does not allow remote mySQL connections and you are only needing to access fairly simple records, all hope is not lost.

I had that situation and to solve the problem I created what I call a black box. This black box was a PHP script that ran on the remote server. You would pass data to it from the remote location and it would lookup and retrieve the records from the mySQL database. It would then send the data back to the calling script so you you could parse and use it as needed.

Yes it does slow the page down slightly and don't do something like this with data that needs to be secure.
 
Older threads
Newer threads
Replies
2
Views
3,442
Replies
9
Views
3,591
Replies
17
Views
6,072
Replies
22
Views
8,003
Latest threads
Replies
1
Views
26
Replies
0
Views
39
Replies
0
Views
39
Replies
1
Views
51
Replies
3
Views
114

Latest postsNew threads

Referral contests

Referral link for :

Sponsors

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top