Setting Up mysql as utf8 for Ruby on Rails using homebrew
It took me far to much time to get this to work right so hopefully this is helpful for someone (probably me at some point in the future).
The hashrocket guys have a great writeup on configuring your development environment. I didn't need some of their bash configuration but it's a great starting place.
Once you have mysql installed with homebrew it can still be handy to customize your mysql configuration. Here's an article on how to configure my.cnf.
My configuration ended up looking like the code below which I got from this article. Here's more info on the values you can specify. I placed the code into '/etc/my.cnf'. That's probably more global than most people want, but it works great for me.
[mysqld] #Max packetlength to send/receive from to server. max_allowed_packet=64M #socket = /var/mysql/mysql.sock character-set-server = utf8 default-character-set = utf8 #This option makes InnoDB to store each created table into its own .ibd file. innodb_file_per_table [mysql] default-character-set = utf8 [client] #socket = /var/mysql/mysql.sock default-character-set=utf8
Here's how I ended up installing the mysql gem. (Always a pain to get this right).
sudo env ARCHFLAGS="-arch x86_64" gem install mysql --no-rdoc --no-ri -- --with-mysql-config=/usr/local/bin/mysql_config
Justin Ball is a software consultant and entrepreneur with a passion for Ruby. He evolved from a C++ and .Net monkey into a python programmer and finally found Ruby. In the rare moments when he isn't writing code, talking about code or measuring his code productivity in profanity per hour, you can find him on his bike in the mountains or on the roads surrounding Cache Valley. 









