Rake Aborted wont Migrate mysql

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

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. [email protected]:

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. [email protected]:

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)

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

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

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
[email protected].

To unsubscribe from this group, send email to
[email protected].

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