Rails can't connect to MySQL

Hey guys,
I’m trying to run a db:migrate but I keep getting errors… I’m running
Rails 2.3.2, Ruby 1.8.6, and MySQL 5.1.38. This is how my database.yml
is set up:

development:
adapter: mysql
database: chirp
host: localhost
username: root
password: mypassword
port: 3306

I installed the mysql gem via:
gem install mysql –
–with-mysql-config=/usr/local/mysql/bin/mysql_config

…which installed them gem, but couldn’t get the documentation. When I
run a rake db:migrate --trace, I get this:

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
Mysql::Error: query: not connected: CREATE TABLE schema_migrations
(version
varchar(255) NOT NULL) ENGINE=InnoDB
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_a
dapters/abstract_adapter.rb:212:in log' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_a dapters/mysql_adapter.rb:320:inexecute’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_a
dapters/abstract/schema_statements.rb:114:in create_table' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_a dapters/mysql_adapter.rb:473:increate_table’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_a
dapters/abstract/schema_statements.rb:320:in
initialize_schema_migrations_table ' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb :436:ininitialize’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb
:400:in new' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb :400:inup’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/migration.rb
:383:in migrate' c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/databases.rake:116 c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:incall’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:ineach’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in execute' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:ininvoke_with_call_c
hain’
c:/ruby/lib/ruby/1.8/monitor.rb:242:in synchronize' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:ininvoke_with_call_c
hain’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in invoke' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:ininvoke_task’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
top_level' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:ineach’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in
top_level' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exceptio
n_handling’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in
top_level' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:inrun’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
standard_exceptio n_handling' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:inrun’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
c:/ruby/bin/rake:19:in `load’
c:/ruby/bin/rake:19

Can anybody help me out? I’m trying to get this app done as a code test
for a job!! Any help is appreciated!

Thanks in advance,

  • Jeff

btw, I know MySQL is working fine because I can console into it and do
whatever. It is also working for my J2EE apps and is set up on port
3306.

Jeff M. wrote:

btw, I know MySQL is working fine because I can console into it and do
whatever. It is also working for my J2EE apps and is set up on port
3306.

Did you create the database yet? You have to do that before migrating.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Marnen Laibow-Koser wrote:

Jeff M. wrote:

btw, I know MySQL is working fine because I can console into it and do
whatever. It is also working for my J2EE apps and is set up on port
3306.

Did you create the database yet? You have to do that before migrating.

Oh…just realized something else. If you search this list and the main
Ruby list, you will find that a lot of people are apparently having
problems with mySQL 5.1 and Windows. I don’t use either of those
technologies, so I don’t recall the solution, but do check.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

yep, sure did. Just did a show databases; to make sure.

Hey, just FYI I got it working… it seems like MySQL 5.1 doesn’t like
Rails 2.2 very much… gotta get the older library: