MySql for Rails on OSX Leopard
May 06, 2008
As of now, this is much simpler than many blog posts make out.
I downloaded the OSX .dmg from http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg, double clicked on the .dmg and installed
- mysql package
- mysql startup
- mysql preference pane
Then
- went to “system preferences” and started the server using the preference pane.
- ensured my path included “/usr/local/mysql/bin”
- checked local installation by running “mysql -u root” from a terminal
Installing the MySql Gem
This has following pre-requisites
- Installation of XCode
- Installation of MySql and ability to find mysql_config
I ran the following command
sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
and the Gem installed fine
Finally tested by creating sample application
rails mysql-test -d mysql
Then in newly created folder
rake db:create:all
Then check databases exist in MySQL using “show databases;”.