Installing MySQL (+gem) On Leopard
Here’s how I installed MySQL. Just make sure you have the developer package installed on your Mac.
Step 1 – Source Code
- Download the source from here.
- Extract the source code to whatever directory you designate. In my case, it’s ~/Source/mysql-5.0.45/
Step 2 – Configure/make/make install
Go to the source directory and run following commands in sequence.
./configure --prefix=/usr/local/mysql --with-mysqld-user=_mysql
make
sudo make install (will prompt for password)
Step 3 – Post Installation
These are the standard post-installation setups where I’m just setting the permissions to use _mysql account on Mac OS X. Another thing, please add /usr/local/mysql/bin to $PATH so that you don’t have to type the path out each time.
Go to the source directory and run following commands in sequence.
sudo chgrp -R _mysql /usr/local/mysql
sudo chown -R _mysql /usr/local/mysql/var
sudo /usr/local/mysql/bin/mysql_install_db
At this point everything is ready, you’ll just have to start the server manually by
sudo mysqld_safe &
but you can have it start automatically at the startup using MySQLCOM script (ok, it’s a wrapper, but you get the drill). I don’t want to get into details here, but just let me know if you want me to cover this.
Step 4 – MySQL Gem
Just as my previous posting, just run
sudo env ARCHFLAGS=”-arch i386″ gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config
That’s it!