# Rake can't connect for some reason

**URL:** <https://www.ruby-forum.com/t/rake-cant-connect-for-some-reason/179417>\
**Category:** Rails\
**Created:** [November 24, 2009, 4:08pm UTC](https://www.ruby-forum.com/t/rake-cant-connect-for-some-reason/179417 "2009-11-24T16:08:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexanderl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f0a364/32.png) [@alexanderl](https://www.ruby-forum.com/u/alexanderl)\
**Post date:** [November 24, 2009, 4:08pm UTC](https://www.ruby-forum.com/t/rake-cant-connect-for-some-reason/179417/1 "2009-11-24T16:08:06Z")

</div>

Hello. I have a problem with rails, i have been coding ruby for a couple  
of weeks and i love it. So now i want to try Rails, and i am following a  
tutorial. Right now i have created a database, set up all the stuff ruby  
need (created a new project etc). Every step so far have been working  
perfect, but now i am currently at the stage where i am going to use  
“rake” to migrate databases/tables.

===============================================

development:  
adapter: mysql  
database: library\_development  
username: root  
password: random  
host: localhost

test:  
adapter: mysql  
database: library\_test  
username: root  
password: random  
host: localhost

production:  
adapter: mysql  
database: library\_production  
username: root  
password: random  
host: localhost

=======================================

Ok, so the database.yml seems nice, the password is working when i  
connect thru mysql in the prompt.  
But when i use “rake migrate:db” i get this error.

==============================================================  
C:\ruby\library\>rake db:migrate --trace  
(in C:/ruby/library)  
\*\* 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.4/lib/active\_record/connection\_a  
dapters/abstract\_adapter.rb:219:in `log' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_a dapters/mysql_adapter.rb:319:in`execute’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/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.4/lib/active_record/connection_a dapters/mysql_adapter.rb:472:in`create\_table’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/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.4/lib/active_record/migration.rb :436:in`initialize’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active\_record/migration.rb  
:400:in `new' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/migration.rb :400:in`up’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active\_record/migration.rb  
:383:in `migrate' c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/tasks/databases.rake:116 c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in`call’  
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:in`each’  
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:in`invoke\_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:in`invoke\_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:in`invoke\_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:in`each’  
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:in`standard\_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:in`run’  
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:in`run’  
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

# C:\ruby\library\>

So, the main error is “Mysql::Error: query: not connected: CREATE TABLE  
`schema_migrations` (`version`  
varchar(255) NOT NULL) ENGINE=InnoDB”.  
I have googled for hours, tried 12 different religions, sacrificed a  
virgin to the honor for ruby and caught an angel. But nothings works.  
What to do?  
Please help  
/Alexander

---

<div class="post-metadata">

**Author:** ![alexanderl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f0a364/32.png) [@alexanderl](https://www.ruby-forum.com/u/alexanderl)\
**Post date:** [November 25, 2009, 5:04am UTC](https://www.ruby-forum.com/t/rake-cant-connect-for-some-reason/179417/2 "2009-11-25T05:04:16Z")

</div>

Hi Alexander L.

```
  Have you read this?

```

[http://halyph.blogspot.com/2009/08/rails-23-migration-issues-with-mysql\_26.html](http://halyph.blogspot.com/2009/08/rails-23-migration-issues-with-mysql_26.html)

Sijo

---

<div class="post-metadata">

**Author:** ![alexanderl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f0a364/32.png) [@alexanderl](https://www.ruby-forum.com/u/alexanderl)\
**Post date:** [November 25, 2009, 9:24am UTC](https://www.ruby-forum.com/t/rake-cant-connect-for-some-reason/179417/3 "2009-11-25T09:24:49Z")

</div>

Sijo k g wrote:

> Hi Alexander L.
> 
> ```
> Have you read this?
> 
> ```
> 
> [http://halyph.blogspot.com/2009/08/rails-23-migration-issues-with-mysql\_26.html](http://halyph.blogspot.com/2009/08/rails-23-migration-issues-with-mysql_26.html)
> 
> Sijo

Woho! Thanks alot, it helped. I love you!
