# Mysql on mac

**URL:** <https://www.ruby-forum.com/t/mysql-on-mac/132951>\
**Category:** Ruby\
**Created:** [March 26, 2008, 3:06am UTC](https://www.ruby-forum.com/t/mysql-on-mac/132951 "2008-03-26T03:06:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![angelojoseph17](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e36b37/32.png) [@angelojoseph17](https://www.ruby-forum.com/u/angelojoseph17)\
**Post date:** [March 26, 2008, 3:06am UTC](https://www.ruby-forum.com/t/mysql-on-mac/132951/1 "2008-03-26T03:06:24Z")

</div>

I installed my sql on my mac tiger and tried to run it but i keep  
getting the error message below and i’ve looked everywhere but there  
seems to be no solution for this can anyone shed any light. ?

angelojoseph:~ angelojoseph$ mysql  
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket  
‘/var/lib/mysql/mysql.sock’ (2)  
angelojoseph:~ angelojoseph$

many thanks,

Angelo Joseph

---

<div class="post-metadata">

**Author:** ![angelojoseph17](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e36b37/32.png) [@angelojoseph17](https://www.ruby-forum.com/u/angelojoseph17)\
**Post date:** [March 26, 2008, 7:59pm UTC](https://www.ruby-forum.com/t/mysql-on-mac/132951/2 "2008-03-26T19:59:49Z")

</div>

Angelo Joseph wrote:

> I installed my sql on my mac tiger and tried to run it but i keep  
> getting the error message below and i’ve looked everywhere but there  
> seems to be no solution for this can anyone shed any light. ?
> 
> angelojoseph:~ angelojoseph$ mysql  
> ERROR 2002 (HY000): Can’t connect to local MySQL server through socket  
> ‘/var/lib/mysql/mysql.sock’ (2)  
> angelojoseph:~ angelojoseph$

I used the instructions here:

[http://www.benslade.com/projects/java/tomcat/InstallingJavaTomcatMySQLOnMacOSX/](http://www.benslade.com/projects/java/tomcat/InstallingJavaTomcatMySQLOnMacOSX/)

which refer to the mysql installation instructions here:

[http://dev.mysql.com/doc/refman/5.0/en/mac-os-x-installation.html](http://dev.mysql.com/doc/refman/5.0/en/mac-os-x-installation.html)

which are a little confusing about how to start mysql.

I also used the additional steps here:

[http://switch.richard5.net/isp-in-a-box-v2/installing-mysql-on-mac-os-x/](http://switch.richard5.net/isp-in-a-box-v2/installing-mysql-on-mac-os-x/)

I put /usr/local/mysql/bin in my PATH environment variable(in my  
.bash\_profile file).

1. To start, type:

$ cd /usr/local/mysql  
$ sudo ./bin/mysqld\_safe  
(Enter your password, if necessary)  
(Press Control-Z)  
$ bg #continue a stopped job in the background–Ctrl+Z stops job?  
(Press Control-D or enter “exit” to exit the shell)  
To get mysql prompt:  
$ mysql -u root

1. To quit mysql prompt, type:

mysql\> exit

1. To shut down mysql:

$ sudo mysqladmin shutdown

1. For help, type:

mysql\> help
