Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install MySQL and create a database on Mac OS X Yosemite

I want to install MySQL on Mac OS X Yosemite, create a new user, then create a new database called "my_database". How can I do this?

What I've tried:

  1. From command line, brew install mysql. This succeeds and downloads MySQL to /usr/local/bin/mysql.

  2. Log into MySQL mysql -u root.

I get an error in Step 2:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)` 

I'm not sure how to fix this. I ran ps ax | grep mysql which showed no MySQL processes were running. Then I ran sudo /usr/local/bin/mysql start but I get the same ERROR 2002 (HY000): Can't connect to local MySQL ....

like image 288
Don P Avatar asked Oct 31 '22 08:10

Don P


1 Answers

You may need to update your path to the mysql socket.

sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

I think this was already answered here: Mysql won't start after upgrading Mac OS X Yosemite (Mac OS 10.10)

like image 181
glind Avatar answered Nov 15 '22 05:11

glind