MySQL Setup On OS X 10.5x – The Missing Procedures

This posting is basically to document the procedure for setup, so others do not have to go through the ordeal that I went through. I am not sure why more explicit instructions are available , since when I Googled for the run-time errors that were produced as a result of using the MySQL DMG package, there were a myriad of comment postings and forum postings but very few solution.

First, download the DMG package and the tar file (both) from MySQL download site. DO NOT INSTALL THE DMG INSTALL PACKAGE. Unpack the tarball and move to /usr/local/yourMySQLVersionFolder (<-substitute with your MySQL unpacked folder name.). Create a symbolic link to MySQL in /usr/local —> sudo ln -s yourMySQLVersionFolder mysql.
A mysql user account is in OS X by default, so move into the mysql folder
–> sudo chown mysql . 
–> sudo chgrp mysql .
Move into the scripts folder and look for a script called mysql_install_db and open in vi, emacs, or your favorite editor and change the line,
localhostname=’/bin/hostname’ to localhostname=’localhost’.
If you do not perform the procedures above, or just go ahead and use the install package provided by MySQL, then all will work just fine after installation. You will develop and program your heart out, feel like the master of your destiny, then once you reboot, MySQL will not let you login to change anything. The error you will most likely see is:
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)
Over and over again, no matter what you do…..
That’s not all…. if you have completed the steps above, you may still get an error that says mysql cannot access /tmp, or something like that. At this point, do the following:
–> cd /usr/local/mysql
–> sudo mkdir tmp
–> sudo chown _mysql:wheel tmp
–> sudo chmod 755 tmp
Then pull up the editor of your choice to edit (or create in my case) /etc/my.cnf to include the following:
[mysqld]
tmpdir=/usr/local/mysql/tmp

At this point, all shoud work. Now go to the DMG package file and double click on the preferences pane icon, and when prompted if you want to include that in system preferences, press the yes button. Then unmount the DMG package and trash it. You’re done.
The frustrating thing about this little adventure were the plethora of install instruction blog sites, but every one of the comments areas were filled with requests about the error above, and everybody had a different solution FOR THE SAME OS!! Hope this saves some time for somebody out there in internet land. If so, please comment. Also, for more morsels of wisdom, please refer to this site and this site, which is where I managed to gather the proper procedures.

Leave a Reply