MIgration error : SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected

Hello,

I have begun since 2 days with Phalcon. I have searched if a similar topic exists but it seems not. So, I try to play with the 'invo' app. I launch in DevTools this command :

phalcon migration generate

In response, I have the following result : c:\wamp\www\invo>phalcon migration --action=generate

Phalcon DevTools (1.2.3)

1376418506.0235: SHOW TABLES Error: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected

Could you help me please and to tell me what is wrong ?

Check your config file, where you store the database information. It should be something like this:

[database]
adapter  = "Mysql"
host     = "127.0.0.1"
username = "myuser"
password = "mypass"
name     = "mydatabase"

Clearly your db name is either missing or incorrect. Also check the permissions that the db user you are using has.

I'm having the same issue. My config file is : [database] adapter ="Mysql" host ="127.0.0.1" username ="root" password ="root" name ="staging"

I know it's a few weeks later, but if it helps, I have a config.php file instead of .ini (not sure why, just came with the install); I also changed host to localhost. Should work as .ini, but the settings below worked for me. I figured out that dbname -> name, among other things.

return new \Phalcon\Config(array( 'database' => array( 'adapter' => 'Mysql', 'host' => 'localhost', 'username' => 'username', 'password' => 'password', 'name' => 'dbname', ), 'application' => array( 'controllersDir' => DIR . '/../../app/controllers/', 'modelsDir' => DIR . '/../../app/models/', 'viewsDir' => DIR . '/../../app/views/', 'baseUri' => '/', ) ));

For the database name array key, try to use 'dbname' instead of 'name', that may fix the problem