问题描述
我执行了以下操作,以在Windows XP上安装Ruby on Rails:
I did the following to install Ruby on Rails on Windows XP:
- 已安装 rubyinstaller-1.9.2-p0.exe
- 宝石安装导轨
- gem安装mysql2
- cd my_dir
- 发布新的my_app -d mysql
- Installed rubyinstaller-1.9.2-p0.exe
- gem install rails
- gem install mysql2
- cd my_dir
- rails new my_app -d mysql
创建的 config/database.yml 包含以下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
但是,当我从 my_dir 运行 rails服务器时,出现以下错误:
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)
...
以及以下弹出消息:
The application has failed to start because LIBMYSQL.dll was not found. Re-installing the application may fix this problem.
我想问题是MySQL的安装.
The problem, I guess, is the installation of MySQL.
我已经安装了WAMP,我想使用它的MySQL安装.
I have WAMP installed, and I would like to use its MySQL installation.
我搜索了 libmysql.dll ,并确实在以下位置找到了它:my_path_to_wamp\bin\mysql\mysql5.1.36\bin\libmysql.dll
I searched for libmysql.dll and indeed found it in: my_path_to_wamp\bin\mysql\mysql5.1.36\bin\libmysql.dll
问题是我如何告诉Rails进行此MySQL安装?
The question is how would I tell Rails to take this installation of MySQL ?
推荐答案
以前安装mysql gem时遇到了这个问题,一个快速的解决方法是将libmysql.dll复制到您的ruby bin文件夹中.最近,我在WAMP MySQL服务器上运行了Rails,没有任何问题,因此,如果不能解决问题,请在解决依赖性问题后发布更具体的错误消息,然后查看配置.
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.
具体来说,我正在运行XAMPP.
Just to be specific, I'm running XAMPP.
这篇关于Ruby on Rails安装问题-如何使用WAMP MySQL安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!