# Rails mysql db:migrate etc

**URL:** <https://www.ruby-forum.com/t/rails-mysql-db-migrate-etc/68468>\
**Category:** Ruby\
**Created:** [September 12, 2006, 10:15pm UTC](https://www.ruby-forum.com/t/rails-mysql-db-migrate-etc/68468 "2006-09-12T22:15:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phlip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Post date:** [September 12, 2006, 10:15pm UTC](https://www.ruby-forum.com/t/rails-mysql-db-migrate-etc/68468/1 "2006-09-12T22:15:56Z")

</div>

Rubies:

Examine this command line:

ruby /usr/local/bin/rake db:migrate --trace

First, a digression about the silly command line, before the actual  
question:

I switched from Ubuntu to Mandriva because the former’s Ruby was so  
broken.  
Mandriva’s is hardly better. When I install all the Ruby RPMs, they put  
Ruby  
in /usr/local/bin/ruby . Then all the Ruby products, like Gems, screw up  
and  
look for libraries in /usr/lib/ruby.

So when I completely uninstall Ruby, and completely build and install it  
from source, it gets this --prefix issue backwards. Gems insists on  
installing things to /usr/local.

I’m sure there’s some command line fix, and I will acknowledge any help,  
but  
the system is currently stable enough to ask the next question.

I have installed MySQL, from RPMs, and my config/database.yml looks a  
little  
like this:

development:  
adapter: mysql  
database: tracks  
host: 127.0.0.1  
username: tracks  
password: password

When I run rake db:migrate, I get this spewage:

```
(in /home/phlip/projects/tracks_1.042)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
Connection refused - connect(2)
/usr/lib/ruby/1.8/mysql.rb:103:in `initialize'
/usr/lib/ruby/1.8/mysql.rb:103:in `new'
/usr/lib/ruby/1.8/mysql.rb:103:in `real_connect'

```

So what am I missing?

Yes, the database exists, mysqld is running as a dæmon, and I have a user  
called ‘tracks’@‘127.0.0.1’ granted permission to do stuff:

```
$ mysql -u tracks -p
Enter password:
mysql> use tracks;
Database changed

```

If you want to tell me to add socket: /tmp/mysql.sock, the file doesn’t  
exist, and socket: /var/lib/mysql/mysql.lock doesn’t either! Oh, and I  
got  
it all working in WinXP fine…

The mysql.rb is the Ruby-only one. I will build the .so version and try  
it.  
But WinXP only worked with the Ruby-only mysql.rb file!

For my next magical trick, I shall figure out why CygWin’s SSH keeps  
aborting on \<Ctrl+C\>, and why CygWin-X keeps blanking the mouse cursor  
and  
leaving it off!

---

<div class="post-metadata">

**Author:** ![Phlip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Post date:** [September 13, 2006, 3:26am UTC](https://www.ruby-forum.com/t/rails-mysql-db-migrate-etc/68468/2 "2006-09-13T03:26:24Z")

</div>

Phlip wrote:

> broken. Mandriva’s is hardly better. When I install all the Ruby RPMs,  
> they put Ruby in /usr/local/bin/ruby . Then all the Ruby products, like  
> Gems, screw up and look for libraries in /usr/lib/ruby.

So make a symlink from the real library directory to the expected one.

---

<div class="post-metadata">

**Author:** ![Phlip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Phlip](https://www.ruby-forum.com/u/Phlip)\
**Post date:** [September 13, 2006, 7:40am UTC](https://www.ruby-forum.com/t/rails-mysql-db-migrate-etc/68468/3 "2006-09-13T07:40:27Z")

</div>

Paul L. wrote:

> > I switched from Ubuntu to Mandriva because the former’s Ruby was so  
> > broken. Mandriva’s is hardly better. When I install all the Ruby RPMs,  
> > they put Ruby in /usr/local/bin/ruby . Then all the Ruby products, like  
> > Gems, screw up and look for libraries in /usr/lib/ruby.
> 
> So make a symlink from the real library directory to the expected one.

Thank you for reminding me how I fixed it back when Mandriva was  
Mandrake!

(I should’a remembered to post it; sorry.)

Now is there a non-workaround here? Or is Mandriva just less broken?

(BTW I fixed the MySQL problem by jamming in SQLite and not looking  
back, so  
once again workarounds rule!)
