用于Ruby On Rails的MySQL Gem
我到处搜索,没有解决方案解决我的问题。 我使用SQLite而不是MySQL构建了rails应用程序。 对于这个特定的项目,我需要MySQL。 当我尝试启动服务器时出现错误,因此我尝试为MySQL安装gems并获得另一个错误。 有没有人有任何见解? 谢谢!
rails server Could not find gem 'mysql2 (>= 0)' in any of the gem sources listed in your Gemfile. sudo gem install mysql2 Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/ext/mysql2/gem_make.out
我有这个问题。 您需要使用本机扩展安装mysql gem。
您可能正在寻找的这条线是这样的:
$ ARCHFLAGS="-arch x86_64" gem install mysql2 --version '~> 0.2.7' -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
全文写下来吧: http : //softwaregravy.com/mysql-on-os-x-rails-3-0-7/
- 尝试使用rake db创建数据库时出现此错误:在Google上创建可以SQL服务器
- Ruby on Rails MYSQL错误用户’root @ localhost’访问被拒绝
- 如何在ruby中创建ssh隧道,然后连接到远程主机上的mysql服务器
- 使用SQLite与MySQL与Ruby?
- 在查询随机简单查询时丢失与MySQL服务器的连接
- 使用ActiveRecord在表上自行加入
- rake db:create generated“如果你手动设置字符集,请确保你有匹配的排序规则”错误
- Rails 3.2 + MySQL:错误:字段’created_at’没有默认值:INSERT INTO
- 如何将数据从ASCII(ISO / IEC 8859-1)导入到我的Rails / PGSQL数据库?