mysql - 如何解决 ROR-4 中的加载错误

标签 mysql ruby-on-rails ruby

请任何人可以帮助我解决此错误。输入 gem install mysql 后,我输入了bundle install。 当我输入命令 rake db:create/bundle exec rake db:create 时,出现以下错误。

错误:

LoadError: cannot load such file -- mysql/mysql_api
c:/Site/book/config/application.rb:7:in `<top (required)>'
c:/Site/book/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

配置/application.rb

require File.expand_path('../boot', __FILE__)

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module Sqldb
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de
  end
end

我的 rakefile 包含以下代码。

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)

Rails.application.load_tasks

请帮助我解决此错误。

最佳答案

您是否尝试从 32 位 Ruby 安装访问 64 位 MySQL 安装。这似乎是很多人的问题,甚至我在拥有新的Win7(64位)新机器时也遇到过这个问题。

尝试此博客上提供的解决方案:-

http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/

关于mysql - 如何解决 ROR-4 中的加载错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27561033/

相关文章:

php - 查询不想执行

ruby - 在一次操作中从 Ruby Set 中获取和删除元素

ruby-on-rails - rails : Resetting form fields with page refresh

php - Laravel 5.5 带有 cron 的调度程序命令

mysql - 在 PHP 中组合 MySQL 查询

javascript - 如何在 Ruby on Rails 中显示条形图的图例?

ruby-on-rails - Rails - "can' t 将符号转换为字符串”,仅限生产

javascript - 开发中的 Rails 4 Long Coffeescript 编译时间

ruby - 在 Ruby on Rails 中解密 PKCS7

php - 从选择增量mysql更新