# Connecting to a remote database

**URL:** <https://www.ruby-forum.com/t/connecting-to-a-remote-database/98506>\
**Category:** Rails\
**Created:** [July 15, 2006, 5:09am UTC](https://www.ruby-forum.com/t/connecting-to-a-remote-database/98506 "2006-07-15T05:09:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsl239](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3bc359/32.png) [@dsl239](https://www.ruby-forum.com/u/dsl239)\
**Post date:** [July 15, 2006, 5:09am UTC](https://www.ruby-forum.com/t/connecting-to-a-remote-database/98506/1 "2006-07-15T05:09:27Z")

</div>

Hi,

I’m having trouble connecting to a remote database (mysql). I know that  
my connection settings are correct, since I have a php app that is  
connecting to the same database.

Are there any settings besides the following that I need in my database  
config file? Any other suggestions?

development:  
adapter: mysql  
database: db\_name  
username: username  
password: password  
host: [mysql45.secureserver.net](http://mysql45.secureserver.net)

---

<div class="post-metadata">

**Author:** ![dsl239](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3bc359/32.png) [@dsl239](https://www.ruby-forum.com/u/dsl239)\
**Post date:** [July 15, 2006, 7:39am UTC](https://www.ruby-forum.com/t/connecting-to-a-remote-database/98506/2 "2006-07-15T07:39:58Z")

</div>

No that’s about it…  
when you say “having trouble”, could you be more specific? What’s the  
error  
stack say?

---

<div class="post-metadata">

**Author:** ![dsl239](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3bc359/32.png) [@dsl239](https://www.ruby-forum.com/u/dsl239)\
**Post date:** [July 15, 2006, 4:10pm UTC](https://www.ruby-forum.com/t/connecting-to-a-remote-database/98506/3 "2006-07-15T16:10:36Z")

</div>

Brian H. wrote:

> No that’s about it…  
> when you say “having trouble”, could you be more specific? What’s the  
> error  
> stack say?

It says “A connection attempt failed because the connected party did not  
properly respond after a period of time, or established connection  
failed because connected host has failed to respond. - connect(2)”

---

<div class="post-metadata">

**Author:** ![dsl239](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3bc359/32.png) [@dsl239](https://www.ruby-forum.com/u/dsl239)\
**Post date:** [July 15, 2006, 7:27pm UTC](https://www.ruby-forum.com/t/connecting-to-a-remote-database/98506/4 "2006-07-15T19:27:02Z")

</div>

Well that’s messed up… host name wrong?

---

<div class="post-metadata">

**Author:** ![dsl239](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3bc359/32.png) [@dsl239](https://www.ruby-forum.com/u/dsl239)\
**Post date:** [July 16, 2006, 2:49am UTC](https://www.ruby-forum.com/t/connecting-to-a-remote-database/98506/5 "2006-07-16T02:49:17Z")

</div>

Brian H. wrote:

> Well that’s messed up… host name wrong?

No, checked it several times. It’s exactly the same as my php app is  
using. Do you think that it could be something about the password (I  
saw somewhere that Rails requires the new MySQL password hashing. This  
MySQL DB is version 4.something not V5

---

<div class="post-metadata">

**Author:** ![dsl239](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3bc359/32.png) [@dsl239](https://www.ruby-forum.com/u/dsl239)\
**Post date:** [July 17, 2006, 2:25pm UTC](https://www.ruby-forum.com/t/connecting-to-a-remote-database/98506/6 "2006-07-17T14:25:01Z")

</div>

Dan: It’s a possibility. I use MySQL 4.1 and 5.0 here… but it’s  
acting  
like the database can’t be found. What version database do you have?

---

<div class="post-metadata">

**Author:** ![dsl239](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3bc359/32.png) [@dsl239](https://www.ruby-forum.com/u/dsl239)\
**Post date:** [July 17, 2006, 3:11pm UTC](https://www.ruby-forum.com/t/connecting-to-a-remote-database/98506/7 "2006-07-17T15:11:27Z")

</div>

anonymous wrote:

> Brian H. wrote:
> 
> > Dan: It’s a possibility. I use MySQL 4.1 and 5.0 here… but it’s  
> > acting  
> > like the database can’t be found. What version database do you have?
> 
> Could there be a firewall on the DB Machine that is allowing the machine  
> with the PHP app to pas but blocking off the requests from the MySQL  
> machine?

I don’t think so because the two apps are hosted on the same machine  
(the PHP and RoR). It is MySQL 4.0.24

Thanks,

Dan

---

<div class="post-metadata">

**Author:** ![dsl239](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3bc359/32.png) [@dsl239](https://www.ruby-forum.com/u/dsl239)\
**Post date:** [July 17, 2006, 2:45pm UTC](https://www.ruby-forum.com/t/connecting-to-a-remote-database/98506/8 "2006-07-17T14:45:35Z")

</div>

Brian H. wrote:

> Dan: It’s a possibility. I use MySQL 4.1 and 5.0 here… but it’s  
> acting  
> like the database can’t be found. What version database do you have?

Could there be a firewall on the DB Machine that is allowing the machine  
with the PHP app to pas but blocking off the requests from the MySQL  
machine?

---

<div class="post-metadata">

**Author:** ![dsl239](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3bc359/32.png) [@dsl239](https://www.ruby-forum.com/u/dsl239)\
**Post date:** [July 17, 2006, 4:52pm UTC](https://www.ruby-forum.com/t/connecting-to-a-remote-database/98506/9 "2006-07-17T16:52:52Z")

</div>

Dan: Could very well be the password thing then.
