Solved

Accessing MySQL database on another domain.

Posted on 2011-09-29
5
544 Views
Last Modified: 2013-11-13
Here are my circumstances:

I have a website  called www.website1.com

I have scripts that access a MySQL database on the same domain.

I have a website called www.website2.com

I scripts to access a  MySQL database on the same domain.

All of the above works.

I need to access the MySQL database on website2 using a script on website1.

Website 1 is hosted on GoDaddy
Website 2 is hosted in my office.    

For some reason, the connect script, doesn't connect if I use known working credentials.   I tried it from several different hosting accounts with GoDaddy.  

Any suggestions on how to debug this.     Here are the error message my test connection code throws up.

Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 110 in /home/content/w/b/l/wblocal2008/html/database/testconn.php on line 77
Could not connect to the server 'xxxxxxxxxxxx.no-ip.info'

Lost connection to MySQL server at 'reading initial communication packet', system error: 110
Warning: mysql_select_db() [function.mysql-select-db]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/w/b/l/wblocal2008/html/database/testconn.php on line 98

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/content/w/b/l/wblocal2008/html/database/testconn.php on line 98
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)


0
Comment
Question by:Gary Fuqua, CISSP
  • 3
  • 2
5 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
Have you checked to see if access on port 3306 for MySQL is allowed thru your ISP?  Also, firewalls will generally block external requests unless you have expressly allowed them.  You can check to see if port 3306 is blocked by going to https://www.grc.com/x/ne.dll?bh0bkyd2 and use the "Lookup Specific Port Information" button to check it.   Also check your firewall to see if port 3306 is allowed Inbound.

If both those things are allowed and you still can't access your home server, then Godaddy may be blocking it.  Another questioner moved to another hosting service because he couldn't access his MS SQL database elsewhere.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
I just tried to access a MySQL installation on one of my Linux hosts from my Godaddy host and it won't connect.  I connect to it all the time from home so I know remote access is not blocked on the Linux host.
0
 
LVL 3

Author Comment

by:Gary Fuqua, CISSP
Comment Utility
Thanks for going through the effort Dave.   I have come to a similar impasse.   I think it might be GoDaddy.     I will make the call to GoDaddy and post the results.  
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
I just called them and they said they block access to external databases.
0
 
LVL 3

Author Comment

by:Gary Fuqua, CISSP
Comment Utility
GoDaddy confirmed.   They do not allow connections to external databases from the shared hosting environments.      
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now