# Mysql on leopard

**URL:** <https://www.ruby-forum.com/t/mysql-on-leopard/133247>\
**Category:** Rails\
**Created:** [March 29, 2008, 8:09am UTC](https://www.ruby-forum.com/t/mysql-on-leopard/133247 "2008-03-29T08:09:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sweetpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@sweetpete](https://www.ruby-forum.com/u/sweetpete)\
**Post date:** [March 29, 2008, 8:09am UTC](https://www.ruby-forum.com/t/mysql-on-leopard/133247/1 "2008-03-29T08:09:07Z")

</div>

Hi

I have installed Mysql on Leopard with Macports.

I have it working ok, but whenever i reboot my computer, the /tmp/  
mysql.sock file gets deleted.

Does anyone know how i can stop this from happening???

Many thanks,

PJ.

---

<div class="post-metadata">

**Author:** ![sweetpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@sweetpete](https://www.ruby-forum.com/u/sweetpete)\
**Post date:** [March 29, 2008, 12:30pm UTC](https://www.ruby-forum.com/t/mysql-on-leopard/133247/2 "2008-03-29T12:30:28Z")

</div>

Hi PJ, you should not ever store anything in /tmp if you would like it  
to  
persist between system reboots. BTW, I have also used MacPorts to  
install  
MySQL and the socket file is located in the following location:  
/opt/local/var/run/mysql5/mysqld.sock

Good luck,

-Conrad

---

<div class="post-metadata">

**Author:** ![sweetpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@sweetpete](https://www.ruby-forum.com/u/sweetpete)\
**Post date:** [March 30, 2008, 1:14am UTC](https://www.ruby-forum.com/t/mysql-on-leopard/133247/3 "2008-03-30T01:14:05Z")

</div>

Hi Conrad,

I’ve been reading some instructions about how to install mysql with  
macports.

The steps i’ve followed are:

1. sudo port install mysql5 +server
2. sudo launchctl load -w /Library/LaunchDaemons/  
org.macports.mysql5.plist
3. sudo mysql\_install\_db5 --user=mysql
4. cd /opt/local ; sudo /opt/local/lib/mysql5/bin/mysqld\_safe &

With these steps i am able to connect to mysql from the Terminal  
command line.

However, when i try to connect with CocoaMySQL, I get this error:

Unable to connect to host localhost.  
Be sure that the address is correct and that you have the necessary  
privileges.  
MySQL said: Can’t connect to local MySQL server through socket ‘/tmp/  
mysql.sock’ (2)

I can only connect to MySQL from CocoaMySQL when I create a sym link:

sudo ln -s /opt/local/var/run/mysql5/mysqld.sock /tmp/mysql.sock

But this /tmp/mysql.sock file is getting deleted when i reboot.

So i guess the problem seems to be with CocoaMySQL. On trying to  
connect, I’ve entered the socket location as /opt/local/var/run/mysql5/  
mysqld.sock - but that does not work either.

???

PJ.

---

<div class="post-metadata">

**Author:** ![sweetpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c5a1d2/32.png) [@sweetpete](https://www.ruby-forum.com/u/sweetpete)\
**Post date:** [March 30, 2008, 1:20am UTC](https://www.ruby-forum.com/t/mysql-on-leopard/133247/4 "2008-03-30T01:20:32Z")

</div>

Oops, sorry…

I just tried entering the socket in Cocoa again(correctly) - and it’s  
working.

🙂

PJ.
