Modify the mysql. server script file using the following command :
sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /usr/local/mysql/support-files/mysql.server
Locate the configuration defining the basedir and set the following :
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
Save the file and start the mysql server in the system preferences or terminal.