简体   繁体   中英

Rails installation windows 7 bad file descriptor mysql2

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'

gem install mysql2 -v '0.2.6' # is successful

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.dll C:\\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.

The root of all this evil is the mysql2 0.2.6 gem. I knew, if I installed mysql2 latest version this will be all good.

  • I uninstalled mysql 5.6.
  • Downloaded mysql 5.5.32 32-bit from http://dev.mysql.com/downloads/mysql/5.5.html#downloads Installed in a standard way
  • Already rails 3.2.12, ruby 1.9.3 were installed in my windows 7 system(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 is installed, It has to be here "c:\\Program Files\\MySQL\\MySQL Server 5.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\\MySQL Server 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:\\Program Files\\MySQL\\MySQL Server 5.5\\include"'

Thats it.

bundle install
rake db:migrate

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM