There MAY be a 10.6 installer for MySQL. Before engaging in this tutorial, please do proper research to see if there are easier and more direct ways of installing MySQL for Snow Leopard.
It appears that a 10.5 friendly version of mysql has been released. Before engaging in this tutorial you might want to check with a more traditional install procedure that comes with the newest version of mysql.
Firstly, I should preface this post by saying that there are probably at least a dozen posts on this topic. All are basically the same with little differences here and there. None of them worked for me. But what did work (so far) is taking bits and pieces from a post here and a post there to finally get something working. Thanks goes out to all those other bloggers who provided the information found here.
Additionally, if things keep going the way they had been, this might not work at all. I have had MySQL up and running several times only to return to find it no longer wants to start for me.
Keep in mind that this is my attempt at a new install of MySQL on my newly acquired MacBook Pro (MBP hereinafter).
Step 1: Enable your root user
- Open the Directory Utility: In the Finder, navigate to the Utilities folder (tip: click on the desktop, hit Cmd+Shift+U).
note – if you are using Snow Leopard, Directory Utility is located at /System/Library/CoreServices, please note that I updated just this portion on the post and have not tested this any further with Snow Leopard to attempt to clarify some comments below.
- Click on the padlock to allow edits.
- Go Edit > Enable Root User
- Enter and re-enter your password.
Now, you are set to access protected areas of the system via the terminal.
[Excerpt from StringFoo’s post]
Step 2: Backup any existing databases from previous versions of MySQL
I never had anything installed so I never attempted to do so. But this goes without saying for you other folks.
Step 3: Remove previous versions of MySQL
I did attempt multiple installs so I did remove them prior to my finally working install. I had nothing to preserve so again, if you are looking to backup a previous version you might want to research it.
- Open a new Terminal window.
- Remove the installed location by typing
sudo rm -rf /usr/local/mysql(keep in mind that if you backed up your databases in this directory it is targeted to get deleted!!!). What this basically says (for all of we new Mac users is: super user remove the targeted folder and recursively do so to any subsequent folders and files from this location.
- Remove any launchers by typing
sudo rm -rf /Library/StartupItems/MySQLCOM/
[Excerpt from Hivelogic’s post]
Step 4: Add environment variables and some Terminal alias to launch MySQL
- Open a Terminal window.
- Use a command-line text editor to create the enviro-vars and aliases by typing
pico ~/.bash_login(that is a tilde not a dash btw). This opens the pico text editor and either opens or creates the .bash_login hidden file at your user’s folder.
- Add the following text:
alias mysql-start="sudo /usr/local/mysql/support-files/mysql.server start"
alias mysql-stop="sudo /usr/local/mysql/support-files/mysql.server stop"
- type ctrl-x to initiate closing Pico.
- type y to save it.
- type enter to save to the prompted location
- You should now be back in Bash
- Now get Teminal to load those new aliases and path type:
Step 5: Grab the MySQL installer and install
- Grab the appropriate installer from the MySQL download page (I am using the intel based MBP)
- Install to the default locations.
- I went ahead and installed the System Preferences utility that is supposed to help you start/stop MySQL’s server, however it did not work. Do so if you wish and maybe you can get it to work. Here are some comments on how you might get it going
Step 6: Update ownership of some launch-specific files
- In a terminal window, type the following in order to create a folder where the MySQL sock file will live.
- Create the folder:
sudo mkdir /var/mysqlThis just says super user make directory mysql in the var directory
- Change ownership of that directory to the user _mysql:
sudo chown _mysql /var/mysql
[Excerpt from StringFoo’s post]
Step 7: Start the MySQL server and then login
Hopefully, if I remember all the steps I took to get this working and it actually works for you, then you should be able start the MySQL server and login.
- If all is well you should see a succsss message. So now login by typing:
mysql -u rootThis just means login to the MySQL server as the user root
- If that works then you should see a prompt saying
- If you want to stop the MySQL server, exit the current user by typing:
- You should now be back in the terminal so type:
mysql-stopYou should then see another Success message saying that you stopped the server
That’s it. Again, I should really thank the community out there for providing various approaches to getting this thing up and running on Leopard. If you are like me, a new Mac user, then hopefully this will get you working with MySQL. Keep checking the web for a Leopard supported installer so then we can make use of the System Preferences MySQL launcher.