轨道上的红宝石 + xampp + mysql(Windows 7)

发布于 2024-09-26 13:59:00 字数 943 浏览 6 评论 0原文

我正在尝试在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

揽清风入怀 2024-10-03 13:59:00

你安装了 mysql gem 吗?

gem install mysql

之后,您需要转到 XAMPP 文件夹中的 mysql\bin 目录并将其复制

libmysql.dll

到 ruby​​\bin 文件夹中。

尝试一下,让我知道它是否有效。另外,如果您的 MySql 版本是 5.1,您可能需要下载同一 dll 的 5.0 版本。

Did you install the mysql gem?

gem install mysql

After this you need to go to the mysql\bin directory in your XAMPP folder and copy the

libmysql.dll

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.

夏雨凉 2024-10-03 13:59:00
gem install mysql --no-rdoc --no-ri -- '--with-mysql-lib="D:\xampp\mysql\lib" --with-mysql-include="D:\xampp\mysql\include"'

我将此代码用于我的 mysql 解决方案,这是您可以将 mysql 用于 xampp 的正确方法。

gem install mysql --no-rdoc --no-ri -- '--with-mysql-lib="D:\xampp\mysql\lib" --with-mysql-include="D:\xampp\mysql\include"'

I used this code for my solution of mysql this is the right way you can USE mysql for xampp.

伤感在游骋 2024-10-03 13:59:00

我曾经遇到过类似的问题。我注意到的重要事情是我已经安装了 mysql 以便通过 xampp 使用。首先,您应该确保可以从 cmd 访问 mysql 安装,方法是输入:

    mysql --version

如果它给您安装的答复,那么您就可以进入下一步,否则复制 mysql bin 目录并将其保存在您的用户环境变量中称为路径。这应该可以让您有效地运行上面的 cmd 代码。
下一步:运行(在cmd上)

    gem install mysql2 --no-rdoc --no-ri

这对我有用。

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

    mysql --version

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)

    gem install mysql2 --no-rdoc --no-ri

This worked for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文