# Link to mysql.sock deleted at reboot

**URL:** <https://www.ruby-forum.com/t/link-to-mysql-sock-deleted-at-reboot/153101>\
**Category:** Rails\
**Created:** [November 12, 2008, 8:16am UTC](https://www.ruby-forum.com/t/link-to-mysql-sock-deleted-at-reboot/153101 "2008-11-12T08:16:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [November 12, 2008, 8:16am UTC](https://www.ruby-forum.com/t/link-to-mysql-sock-deleted-at-reboot/153101/1 "2008-11-12T08:16:22Z")

</div>

I’m on Mac OS 10.5. How do I get a link from /tmp/mysql.sock to  
/opt/…/mysql.sock to stay after reboot?

Is there a better way of doing this, like adding an alias in .profile if  
possible, or is it assumed that you never reboot your machine? 🙂

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [November 12, 2008, 10:23am UTC](https://www.ruby-forum.com/t/link-to-mysql-sock-deleted-at-reboot/153101/2 "2008-11-12T10:23:48Z")

</div>

Why don’t you use the socket option in database.yml to point to  
opt/… ? You can use this setting for development and another for  
production. Alternatively create database.mymachine.yml and  
database.production.yml and link the right file to database.yml

On Nov 12, 12:16 pm, Pål Bergström [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [November 12, 2008, 10:32am UTC](https://www.ruby-forum.com/t/link-to-mysql-sock-deleted-at-reboot/153101/3 "2008-11-12T10:32:30Z")

</div>

Mukund wrote:

> Why don’t you use the socket option in database.yml to point to  
> opt/… ? You can use this setting for development and another for  
> production. Alternatively create database.mymachine.yml and  
> database.production.yml and link the right file to database.yml
> 
> On Nov 12, 12:16ï¿½pm, Pï¿½l Bergstrï¿½m [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

I could do that, but it’s convenient to use /tmp/mysql.sock as other  
programs look there first.

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [November 12, 2008, 11:48am UTC](https://www.ruby-forum.com/t/link-to-mysql-sock-deleted-at-reboot/153101/4 "2008-11-12T11:48:57Z")

</div>

On 12 Nov 2008, at 09:32, PÃ¥l BergstrÃ¶m wrote:

> > [s.net](http://s.net)\>
> 
> I could do that, but it’s convenient to use /tmp/mysql.sock as other  
> programs look there first.

Presumably you can configure mysql to put its socket in /tmp rather  
than in /opt/…

Fred

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [November 12, 2008, 3:36pm UTC](https://www.ruby-forum.com/t/link-to-mysql-sock-deleted-at-reboot/153101/5 "2008-11-12T15:36:31Z")

</div>

On Nov 12, 4:05 am, Pål Bergström [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > Fred
> 
> True. But not sure my skills are up to that. Yet another thing to figure  
> out 🙂
> 
> I think I’ll try to make a applecsript/shell script that runs at  
> startup. I’ve done something similar before.
> 
> Thanks for the help.

Here are a couple of articles I used to help me get Rails & MySql  
running on Leopard.

> **[Apache Version in Leopard?](https://forums.macrumors.com/threads/apache-version-in-leopard.374993/?post=4394679#post-4394679)**
>
> Found the answer on another forum. For anyone else having trouble, here's the solution:
> 
> you need to do the following in terminal.app when safe\_mysql is running.
> 
> sudo mkdir /var/mysql/
> 
> sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
> 
> Then restart...

> **[Dan Benjamin](https://danbenjamin.com)**
>
> Dan Benjamin's personal website.

hth,

Craig

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [November 12, 2008, 12:05pm UTC](https://www.ruby-forum.com/t/link-to-mysql-sock-deleted-at-reboot/153101/6 "2008-11-12T12:05:41Z")

</div>

Frederick C. wrote:

> On 12 Nov 2008, at 09:32, PÃ¥l BergstrÃ¶m wrote:
> 
> > > [s.net](http://s.net)\>
> > 
> > I could do that, but it’s convenient to use /tmp/mysql.sock as other  
> > programs look there first.
> 
> Presumably you can configure mysql to put its socket in /tmp rather  
> than in /opt/…
> 
> Fred

True. But not sure my skills are up to that. Yet another thing to figure  
out 🙂

I think I’ll try to make a applecsript/shell script that runs at  
startup. I’ve done something similar before.

Thanks for the help.

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [November 12, 2008, 9:08pm UTC](https://www.ruby-forum.com/t/link-to-mysql-sock-deleted-at-reboot/153101/7 "2008-11-12T21:08:02Z")

</div>

PÃ¥l BergstrÃ¶m wrote:

> I’m on Mac OS 10.5. How do I get a link from /tmp/mysql.sock to  
> /opt/…/mysql.sock to stay after reboot?
> 
> Is there a better way of doing this, like adding an alias in .profile if  
> possible, or is it assumed that you never reboot your machine? 🙂

This might do what you want with the values you want in it:

# recipe 25 from “rails recipes”

# 

# dynamicly configure the database

# 

socket: \<%= ["/tmp/mysqld.sock",  
“/tmp/msql.sock”,  
“/var/run/mysqld/mysqld.sock”,  
“/var/run/mysqld/mysql.sock”].detect{|socket|  
File.exist?(socket)  
} %\>
