rake db:migrate fail! bad descriptor

Dear All,

I am just getting into Ruby on Rails, after successfully failing at getting any other programming language to work locally. RoR appears to be a repeat! One problem I keep running into is getting a database up and running.

I'm working out of Windows XP.

I installed MySQL, it works, runs, will create tables etc. BUT, when I do rake db:migrate...it fails and tells me I have a bad descriptor. I've spent over 24 hours now searching, uninstalling, reinstalling, deleting, re-creating everything, and to no avail. SQLite also doesn't want to work. I am a TOTAL newbie to programming, so I have no idea what's needed or wanted by any of each of these little things I installed. I just follow the instructions, install what they recommend and cross my fingers.

Also, I'm not connected to the internet via XP, so I had to manually download and install ALL gems, how fun. Anyway, do I NEED to be connected for the MySQL gem, or should I already have it? What should I have in order for everything to work, so far I have WEBrick running, I have an IDE, I have the package manager, I have Ruby installed, it's only the dbs that are haunting me.

I've checked the database.yml file and MySQL and WEBrick are both running. I don't get it.

What else do I need? What should I try?

Thanks!

You do need to install the mysql gem. The top of the file config/database.yml has a comment listing the gem that is needed. That may be your answer.

BCSnow wrote:

Do I have to install it via the internet, or is there somewhere to download it?

Thanks.

If that doesn’t help, can you paste in your migration file as well as the exact error message you are getting. We’ll get you going!

William Pratt wrote:

You can download it. Here is the url with instructions: http://www.vandomburg.net/pages/mysql-ruby-windows

BCSnow wrote:

I downloaded that link and followed the instructions, didn't work.

The password for MySQL is different than the password for the database correct?

When I created the database I typed: mysqladmin -u root -p create depot_development

It asks for a password and I type the MySQL password. This doesn't create a password for the database does it?

The following is the requested info:

c:\depot>rake db:migrate

(in c:/depot) rake aborted! Bad file descriptor - connect(2)

(see full trace by running task with --trace)

001_create_products.rb

class CreateProducts < ActiveRecord::Migration

  def self.up     create_table :products do |t|       t.column :title, :string       t.column :description, :text       t.column :image_url, :string     end   end   def self.down     drop_table :products   end end

What does this mean?

Install MySQL and put its /bin directory on your path.

Especially the path part, I put the /bin directory in c:/depot/ or is it supposed to be the folder where Rails is? Do I move it, or copy it? Thanks!

I also just checked and there are no conflicting ports. WEBrick is listening on 3000 and MySQL is listening on 3307...nothing else is using either of these two. I'm still mystified by on your path.

try in command line: gem install mysql (or gems, dont member exactly) in selection choose latest win32 gem

if "gem" or "gems" are "Bad command or file name", this mean Rails are not installed properly.

setting for mysql connection are in config/database.yml in your rails appication,

Also i suggest to "install" InstantRails, it's windows application that really helps to control your apache/mysql/ruby/rails/ phpmyadmin( servers properly, also it have all extentions needed for rails programming. also useful because it not loading your memory when dont needed. PhpMyAdmin is really powerfull app to admin you mysql. You can find it at rubyforge (http://rubyforge.org/projects/ instantrails/)

Good luck man,

/offtop help to this girl > http://www.yulia-site.org

I've got it working now.

I just needed to add the port to my database.yml file.

Thanks to Dylan at http://www.mboffin.com

So it wasn't - you had already installed gem mysql.. I've never heard of adding a port to a database.yml file. I'd like to know more. Please post your solution in detail..

Thanks Orion

He just means that he added:

port:   3306

to database.yml in his database config. this just tells mysql to use port 3306 instead of a named pipe.

rsgrafx wrote: