# Rake Aborted wont Migrate mysql

**URL:** <https://www.ruby-forum.com/t/rake-aborted-wont-migrate-mysql/181923>\
**Category:** Rails\
**Created:** [January 20, 2010, 9:42am UTC](https://www.ruby-forum.com/t/rake-aborted-wont-migrate-mysql/181923 "2010-01-20T09:42:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![diabolist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c2a13f/32.png) [@diabolist](https://www.ruby-forum.com/u/diabolist)\
**Post date:** [January 20, 2010, 9:42am UTC](https://www.ruby-forum.com/t/rake-aborted-wont-migrate-mysql/181923/1 "2010-01-20T09:42:02Z")

</div>

Hello all, I’ve been trying to get ruby on rails to work with my local  
install of mysql(its with wamp). Windows XP, Ruby 1.8.6, rails 2.3.5,  
rubygems 1.3.5, mysql 5.2 something I believe.

I have ruby installed in:

C:\Ruby

and my mysql is installed in:

C:\wamp\bin\mysql\mysql5.1.30\bin

I’ve attempted to change my database.yml file to include the port 80,  
and port 3036, the socket path, I’ve checked for skip-networking in my  
my.ini file, my mysql bin is included in my path, I have the mysql gem  
installed.

Everytime I try to run: rake db:migrate I get this error, I’d  
appreciate any help I can get, thank you:

-------------- Error -------------

ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]

C:\Ruby\projects\music\_library\>rake db:migrate  
(in C:/Ruby/projects/music\_library)  
rake aborted!  
Mysql::Error: query: not connected: CREATE TABLE `schema_migrations`  
(`version` varchar(255) NOT NULL) ENGINE=InnoDB

(See full trace by running task with --trace)  
C:/Ruby/bin/rake:19: [BUG] Segmentation fault  
ruby 1.8.6 (2009-08-04) [i386-mingw32]

This application has requested the Runtime to terminate it in an unusual  
way.  
Please contact the application’s support team for more information.

-------------- Trace results ----------------

C:\Ruby\projects\music\_library\>rake --trace  
(in C:/Ruby/projects/music\_library)  
\*\* Invoke default (first\_time)  
\*\* Invoke test (first\_time)  
\*\* Execute test  
\*\* Invoke test:units (first\_time)  
\*\* Invoke db:test:prepare (first\_time)  
\*\* Invoke db:abort\_if\_pending\_migrations (first\_time)  
\*\* Invoke environment (first\_time)  
\*\* Execute environment  
\*\* Execute db:abort\_if\_pending\_migrations  
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active\_support/core\_ext/string/output\_safety.rb:36:  
[BUG] Segmentation fault  
ruby 1.8.6 (2009-08-04) [i386-mingw32]

This application has requested the Runtime to terminate it in an unusual  
way.  
Please contact the application’s support team for more information.

----------------- database.yml --------------

development:  
adapter: mysql  
encoding: utf8  
reconnect: false  
database: music\_library\_development  
pool: 5  
port: 3306  
username: root  
password: mypassword  
host: localhost

---

<div class="post-metadata">

**Author:** ![diabolist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c2a13f/32.png) [@diabolist](https://www.ruby-forum.com/u/diabolist)\
**Post date:** [January 20, 2010, 3:06pm UTC](https://www.ruby-forum.com/t/rake-aborted-wont-migrate-mysql/181923/2 "2010-01-20T15:06:36Z")

</div>

have you tried to connect to your mysql server by the mysql-client?

mysql -h localhost -P 3306 -p dbname

2010/1/20 Andrew P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![diabolist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c2a13f/32.png) [@diabolist](https://www.ruby-forum.com/u/diabolist)\
**Post date:** [January 20, 2010, 6:50pm UTC](https://www.ruby-forum.com/t/rake-aborted-wont-migrate-mysql/181923/3 "2010-01-20T18:50:56Z")

</div>

Kristian H. wrote:

> have you tried to connect to your mysql server by the mysql-client?
> 
> mysql -h localhost -P 3306 -p dbname
> 
> 2010/1/20 Andrew P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

I guess I can’t, when I try it asks for my password, I enter it then it  
says:

ERROR 1045 (28000): Access denied for user ‘ODBC’@‘localhost’ (using  
password: YES)

---

<div class="post-metadata">

**Author:** ![diabolist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c2a13f/32.png) [@diabolist](https://www.ruby-forum.com/u/diabolist)\
**Post date:** [January 20, 2010, 8:49pm UTC](https://www.ruby-forum.com/t/rake-aborted-wont-migrate-mysql/181923/4 "2010-01-20T20:49:50Z")

</div>

Solved:

It appears to be a problem with mysql 5.1+ and I was even having it with  
5.0.89. You can fix this by downloading the old libmysql.dll version  
here:

[http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll](http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll)

Just put that file in your Ruby\bin directory, in my case I put that  
inside:

C:\Ruby\bin

Restart your mysql and it should work just fine now.

Also another tidbit of information that might be helpful is that Ruby on  
rails when you create your rails app it will generate your database.yml  
using the default sqlite3 information instead of mysql. This tripped me  
up at first. You can make it so that it makes this file using mysql  
instead of sqlite3 by editing your:

app\_generator.rb, you can find this file inside of:

C:\Ruby\lib\ruby\gems\1.8\gems\rails-2.3.5\lib\rails\_generator\generators\applications\app\app\_generator.rb

On line 9 you’ll find:

DEFAULT\_DATABASE = ‘sqlite3’

change ‘sqlite3’ to ‘mysql’, now rails will generate your database.yml  
file when creating a new app using mysql instead of sqlite3 defaults.

I hope this helps someone.

Andrew

---

<div class="post-metadata">

**Author:** ![diabolist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c2a13f/32.png) [@diabolist](https://www.ruby-forum.com/u/diabolist)\
**Post date:** [January 20, 2010, 10:47pm UTC](https://www.ruby-forum.com/t/rake-aborted-wont-migrate-mysql/181923/5 "2010-01-20T22:47:13Z")

</div>

Andrew P. wrote:

> ```
> ...
> 
> Also another tidbit of information that might be helpful is that Ruby on  
> rails when you create your rails app it will generate your database.yml  
> using the default sqlite3 information instead of mysql. This tripped me  
> up at first. You can make it so that it makes this file using mysql  
> instead of sqlite3 by editing your:
> 
> app\_generator.rb, you can find this file inside of:
> 
> C:\Ruby\lib\ruby\gems\1.8\gems\rails-2.3.5\lib\rails\_generator\generators\applications\app\app\_generator.rb
> 
> On line 9 you’ll find:
> 
> DEFAULT\_DATABASE = ‘sqlite3’
> 
> change ‘sqlite3’ to ‘mysql’, now rails will generate your database.yml  
> file when creating a new app using mysql instead of sqlite3 defaults.
> 
> I hope this helps someone.
> 
> Andrew
> ```

You can alternatively create your rails app with the command 'rails xxx -d mysql' and it will create the database.yml for mysql.  
  
Norm  

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.

To post to this group, send email to  
removed\_email\_address@domain.invalid.

To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.

For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en.](http://groups.google.com/group/rubyonrails-talk?hl=en.)
