Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database not being selected in rails project when attempting to rake db:migrate

Working with a rails app, having some manner of weird database / rake issues.

When I execute:

rake db:migrate

I am getting the following error:

Mysql2::Error: No database selected: SHOW TABLES

(See full trace by running task with --trace)

The trace isn't revealing much useful information. Can be seen here: http://pastebin.com/WdsguudC

The config file looks right, and the user is getting logged in, or I would have gotten some kind of access error. The database exists, the user has correct permission, and I can access and manipulate it manually. I have done a bunch of googling, and haven't found anything helpful. Not sure if there is any other code that needs provided, because this seems like fairly low level problem.

like image 504
re5et Avatar asked Feb 06 '11 08:02

re5et


2 Answers

after all that it was a spacing issue in the yaml.

like image 199
re5et Avatar answered Oct 18 '22 14:10

re5et


Note that ruby has exchanged its YAML parser in a recent 1.9.2 version.

This might also cause this problem.

In order to switch back to the old YAML parser syck, use this in boot.rb:

require 'yaml'
YAML::ENGINE.yamler= 'syck'
like image 26
crispy Avatar answered Oct 18 '22 14:10

crispy