# Remote mysql connection failing under OSX

**URL:** <https://www.ruby-forum.com/t/remote-mysql-connection-failing-under-osx/68820>\
**Category:** Rails\
**Created:** [September 15, 2006, 6:18pm UTC](https://www.ruby-forum.com/t/remote-mysql-connection-failing-under-osx/68820 "2006-09-15T18:18:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ktheory](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Post date:** [September 15, 2006, 6:18pm UTC](https://www.ruby-forum.com/t/remote-mysql-connection-failing-under-osx/68820/1 "2006-09-15T18:18:57Z")

</div>

I’ve run across an interesting (read frustrating) problem. I have  
specific  
application processes I don’t want to burn my hosts processing cycles on  
so  
I’m opting to do the processing on a computer local to me (through a RoR  
installation) and push the data direct to the server. I’ve got  
everything  
setup on both ends, but every attempt to form a connection between my  
local  
box and production mysql host produces the following error:

Mysql::Error: Lost connection to MySQL server during query: SHOW FIELDS  
FROM  
menus

On a whim I set everything up on a Windows box to see if it was a system  
problem or a host problem. Low and behold everything works like a charm  
under windows. My current theory is that this has something to do with  
the  
drivers rails uses under OS X, but I can’t find anyone else’s  
experiences  
who has uncovered a viable solution.

Host: Bluehost (same results with dreamhost)  
Operating Sys: OS X 10.4 and XP SP2 Home  
Ruby/Rails: Latest Release for both

Any advice would be greatly appreciated.

## Regards,

Aaron S. | removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![ktheory](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Post date:** [September 15, 2006, 6:49pm UTC](https://www.ruby-forum.com/t/remote-mysql-connection-failing-under-osx/68820/2 "2006-09-15T18:49:32Z")

</div>

Ive found on OSX i have to specify the socket location for mysql also

Make sure you have the ruby-mysql bindings up and running also

Cheers

Tim

---

<div class="post-metadata">

**Author:** ![ktheory](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Post date:** [September 15, 2006, 7:41pm UTC](https://www.ruby-forum.com/t/remote-mysql-connection-failing-under-osx/68820/3 "2006-09-15T19:41:05Z")

</div>

Tim,

I appreciate the feedback, but I think I left out an important detail.  
I do  
have my rails app connecting to mysql locally. Setting this up has been  
no  
problem whatsoever. Only when I attempt to form a remote connection do  
I  
have any issues.

Thanks,  
Aaron

---

<div class="post-metadata">

**Author:** ![ktheory](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Post date:** [September 16, 2006, 3:20pm UTC](https://www.ruby-forum.com/t/remote-mysql-connection-failing-under-osx/68820/4 "2006-09-16T15:20:25Z")

</div>

Hi Aaron,

On 15 Sep 2006, at 18:35, Aaron S. wrote:

> I appreciate the feedback, but I think I left out an important  
> detail. I do have my rails app connecting to mysql locally.  
> Setting this up has been no problem whatsoever. Only when I  
> attempt to form a remote connection do I have any issues.

Have you checked your firewall settings on Mac OS X? By default, the  
Mac OS X firewall configuration will block remote MySQL socket  
connections. Opening port 3306 on your firewall configuration should  
allow remote connections.

I guess if that doesn’t do the trick, the next thing would by to use  
e.g. the mysql command-line client to try to connect remotely first,  
to rule out a connection issue (as opposed to a Rails issue).

Good luck,

Peter
