轨道上的红宝石 + xampp + mysql(Windows 7)
我正在尝试在 Windows 7 上将 xampp 中包含的 mysql 包与 ruby on Rails 一起使用,但似乎无法让它们一起工作。
我有rails 3.0.0和xampp 1.7.3,
rails可以在xampp中与sqlite配合使用,但是当尝试通过“rails new项目-d mysql; cd项目;捆绑安装”使用mysql时
,我得到以下信息:
Installing mysql2 (0.2.4) with native extensions C:/xampp/Ruby192/lib/ruby/1.9.1 /rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Fail ed to build gem native extension. (Gem::Installer::ExtensionBuildError) C:/xampp/Ruby192/bin/ruby.exe extconf.rb checking for rb_thread_blocking_region()... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
我错过了什么吗?关于这个问题的所有帖子都告诉我使用 gem install mysql -- --with-mysql-config=PATH ,但这似乎不适用于 Windows,因为无论如何我都会遇到相同的错误。
如果这是不可能的,那么现在使用 sqlite,然后稍后尝试将数据库迁移到 mysql(或另一个更强大的数据库)是否有任何缺点?
I am trying to use the mysql package included in xampp with ruby on rails on windows 7, but cannot seem to get them to work together.
I have rails 3.0.0 and xampp 1.7.3
rails works with sqlite within xampp just fine, but when attempting to use mysql via "rails new project -d mysql; cd project; bundle install"
I get the following:
Installing mysql2 (0.2.4) with native extensions C:/xampp/Ruby192/lib/ruby/1.9.1 /rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Fail ed to build gem native extension. (Gem::Installer::ExtensionBuildError) C:/xampp/Ruby192/bin/ruby.exe extconf.rb checking for rb_thread_blocking_region()... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
Am I missing anything? All the posts about this issue tell me to use gem install mysql -- --with-mysql-config=PATH, but this does not seem to work with Windows, as I get the same error regardless.
And if it's just not possible, are there any drawbacks to using sqlite now, then trying to migrate the databse over to mysql (or another more robust database) later?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你安装了 mysql gem 吗?
之后,您需要转到 XAMPP 文件夹中的 mysql\bin 目录并将其复制
到 ruby\bin 文件夹中。
尝试一下,让我知道它是否有效。另外,如果您的 MySql 版本是 5.1,您可能需要下载同一 dll 的 5.0 版本。
Did you install the mysql gem?
After this you need to go to the mysql\bin directory in your XAMPP folder and copy the
into your ruby\bin folder.
Give it a try and let me know if it works. Also if your MySql version is 5.1 you may need to download a 5.0 version of the same dll.
我将此代码用于我的 mysql 解决方案,这是您可以将 mysql 用于 xampp 的正确方法。
I used this code for my solution of mysql this is the right way you can USE mysql for xampp.
我曾经遇到过类似的问题。我注意到的重要事情是我已经安装了 mysql 以便通过 xampp 使用。首先,您应该确保可以从 cmd 访问 mysql 安装,方法是输入:
如果它给您安装的答复,那么您就可以进入下一步,否则复制 mysql bin 目录并将其保存在您的用户环境变量中称为路径。这应该可以让您有效地运行上面的 cmd 代码。
下一步:运行(在cmd上)
这对我有用。
I once had a similar issue. The important things i noted was that i already have mysql installed for usage via xampp. Firstly, you should make sure that the mysql installation is accessible from cmd by typing
If it gives you a reply of our installation then you're good to go to the next step else copy the mysql bin directory and save it in your user environment variable called PATH. This should allow you to run the cmd code above fruitfully.
Next Step: run (on cmd)
This worked for me.