本文介绍了Rails 安装 windows 7 错误的文件描述符 mysql2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的 1 天里,我只尝试并得到了这个,

C:\dev\man>rake db:create --trace** 调用 db:create (first_time)** 调用 db:load_config (first_time)** 执行 db:load_config** 调用 rails_env (first_time)** 执行 rails_env** 执行 db:create耙子中止!错误的文件描述符C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/active_record/connection_adapters/mysql2_adapter.rb:312:in `query'C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/active_record/connection_adapters/mysql2_adapter.rb:312:in`execute'

gem install mysql2 -v '0.2.6' # 成功

什么是坏文件描述符??

我跟着这里,Ruby on rails:rake aborted bad file descriptor没用

我非常不确定这两个文件

C:\Program Files\Mysql\Mysql Server 5.6\lib\libmysql.dllC:\Ruby193\bin\libmysql.dll

我使用的是 windows 7、rails 3.2.12 和 mysql 5.6、ruby 1.9.3

请帮忙!

解决方案

我非常明白这是32位和64位的问题.

我使用 ubuntu 12.04.我知道在 Windows 上使用 Rails 毫无意义.为了让我的设计师能够查看应用程序,必须这样做.

这一切罪恶的根源是 mysql2 0.2.6 gem.我知道,如果我安装 mysql2 最新版本就可以了.

  • 我卸载了 mysql 5.6.
  • 从 mysql 5.5.32 32 位下载http://dev.mysql.com/downloads/mysql/5.5.html#downloads 安装在标准方式
  • 已经在我的 Windows 7 中安装了 rails 3.2.12、ruby 1.9.3系统(就像这里 http://rorguide.blogspot.in/2011/03/installing-mysql2-gem-on-ruby-192-and.html)
  • 现在,我仔细搜索了mysql server 5.5所在的正确路径安装,它必须在这里c:\Program Files\MySQL\MySQL Server5.5\bin",但这里是c:\Program Files (x86)\MySQL\MySQL Server 5.5\bin"
  • 如何知道这一点,只需 cd 到c:\Program Files (x86)\MySQL\MySQL服务器 5.5\bin"并尝试mysql"它不应该说找不到命令"
  • 现在, gem install mysql2 -- '--with-mysql-lib="c:\Program Files(x86)\MySQL\MySQL Server 5.5\lib" --with-mysql-include="c:\ProgramFiles\MySQL\MySQL Server 5.5\include"'

就是这样.

捆绑安装耙数据库:迁移

For the past 1 day, Im trying and getting only this,

C:\dev\man>rake db:create --trace
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:create
rake aborted!
Bad file descriptor
C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/active_record/c
onnection_adapters/mysql2_adapter.rb:312:in `query'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/active_record/c
onnection_adapters/mysql2_adapter.rb:312:in `execute'

What is bad file descriptor??

I followed here, Ruby on rails : rake aborted bad file descriptor didn't work

Im very unsure about these 2 files

C:\Program Files\Mysql\Mysql Server 5.6\lib\libmysql.dllC:\Ruby193\bin\libmysql.dll

Im on a windows 7, rails 3.2.12 and mysql 5.6, ruby 1.9.3

Please help!

解决方案

I very much understood that this is a problem with 32 bit and 64 bit.

I use ubuntu 12.04. I know there is no point in using rails on windows. This has to be done for my designer to be able to view the app.

  • I uninstalled mysql 5.6.
  • Downloaded mysql 5.5.32 32-bit fromhttp://dev.mysql.com/downloads/mysql/5.5.html#downloads Installed ina standard way
  • Already rails 3.2.12, ruby 1.9.3 were installed in my windows 7system(Like in here http://rorguide.blogspot.in/2011/03/installing-mysql2-gem-on-ruby-192-and.html)
  • Now, I carefully searched the right path where mysql server 5.5 isinstalled, It has to be here "c:\Program Files\MySQL\MySQL Server5.5\bin", but it was here "c:\Program Files (x86)\MySQL\MySQL Server 5.5\bin"
  • How to know this, just cd to "c:\Program Files (x86)\MySQL\MySQLServer 5.5\bin" and try "mysql" it should not say "command not found"
  • Now, gem install mysql2 -- '--with-mysql-lib="c:\Program Files(x86)\MySQL\MySQL Server 5.5\lib" --with-mysql-include="c:\ProgramFiles\MySQL\MySQL Server 5.5\include"'

Thats it.

bundle install
rake db:migrate

这篇关于Rails 安装 windows 7 错误的文件描述符 mysql2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 04:51
查看更多