Ruby On Rails Using MySQL database On Snow Leopard

Friday, January 29, 2010

又一次折腾! 在家折腾Ruby on Rails使用MySQL数据库,可是失败

$ rails blog -d mysql
$ vim blog/config/database.yml
$ cd blog; rake db:create --trace
(in /Users/eric/NetBeans_Workspace/blog)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create
# 出错信息
Couldn't create database for {"reconnect"=>false, "encoding"=>"utf8", "username"=>"root", "adapter"=>"mysql", "database"=>"blog_development", "host"=>"127.0.0.1", "pool"=>5, "password"=>"admin", "socket"=>"/tmp/mysql.sock"}, charset: utf8, collation: utf8_unicode_ci (if you set the charset manually, make sure you have a matching collation)

郁闷了, 我的配置都正常, 问朋友, 问google,最后卸载了mysql这个gem再重装64位的mysql gem

$ sudo gem uninstall mysql
$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/Cellar/mysql/5.1.41/bin/mysql_config

cd blog; rake db:create 就ok了

ps:我电脑没开启64位呀,奇怪

参考:http://weblog.rubyonrails.org/2009/8/30/upgrading-to-snow-leopard

This entry was tagged Mac, MySQL and Rails

comments powered by Disqus

© 2009-2013 lxneng.com. All rights reserved. Powered by Pyramid

go to Top