Problem with Ruby on Rails installation - How to u

2019-02-27 06:02发布

I did the following to install Ruby on Rails on Windows XP:

  • Installed rubyinstaller-1.9.2-p0.exe
  • gem install rails
  • gem install mysql2
  • cd my_dir
  • rails new my_app -d mysql

The created config/database.yml contains the following MySQL configuration:

development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: first_development
  pool: 5
  username: root
  password:
  host: localhost

However, when I run rails server from my_dir I got the following error:

D:/Programs/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/mysql2
/mysql2.rb:2:in `require': 126: The specified module could not be found.   - D:/
Programs/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/mysql2/1.
9/mysql2.so (LoadError)
...

along with the following pop-up message:

The application has failed to start because LIBMYSQL.dll was not found. Re-installing the application may fix this problem.

The problem, I guess, is the installation of MySQL.

I have WAMP installed, and I would like to use its MySQL installation.

I searched for libmysql.dll and indeed found it in: my_path_to_wamp\bin\mysql\mysql5.1.36\bin\libmysql.dll

The question is how would I tell Rails to take this installation of MySQL ?

1条回答
放荡不羁爱自由
2楼-- · 2019-02-27 06:20

I've had this problem when installing the mysql gem before, and a quick fix is just to copy the libmysql.dll into your ruby bin folder. I recently got rails running off of a WAMP MySQL server without a problem, so if this doesn't solve it post a more specific error message once you've sorted out the dependency issue and I'll look at my configuration.

EDIT: Just to be specific, I'm running XAMPP.

查看更多
登录 后发表回答