Setting up MySQL on Mac OS

A few notes for next time… and this may help someone else you never know! Even after doing this multiple times it’s easy to forget a step and wonder why things aren’t working.

After moving all my data to a new mac, i need to install mysql.

Install mysql. (Grab a .dmg from

Move my.cnf into place (/etc/my.cnf):
[code]cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf[/code]

Change the datadir in my.cnf:
[code]datadir: /Users/stuart/Sites/mysqldata[/code]

Chown the datadir to user mysql:
[code]chown -R mysql /Users/stuart/Sites/mysqldata[/code]

Create the socket:
[code]touch /tmp/mysql.sock[/code]

Set root user pass:
mysql -u root -p
[enter pass]
use mysql;
update user set password=PASSWORD("lovelyNewPass") where User=’root’;

1 thought on “Setting up MySQL on Mac OS”

Leave a Reply

Your email address will not be published. Required fields are marked *