gii Model Generator CDbConnection error


Following the tutorial, I’ve reached the step to generate the model code. When I click on the Model Generator link in gii, I get the following error:

CDbCommand failed to execute the SQL statement: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected. The SQL statement executed was: SHOW TABLES

This is my db config on main.php:


		'connectionString' => 'mysql:host=;port:3306;dbname=test',

		'emulatePrepare' => true,

		'username' => 'root',

		'password' => 'removed_password',

		'charset' => 'utf8',


And this is my Yii requirement check result:


Screen Shot 2012-07-16 at 11.35.33 AM.png

I’ve searched this forum and others but have not been able to find anything to help me get pass this point.


[color="#1C2837"][size="2"]The clue point is: No database selected.[/size][/color]

[color="#1C2837"][size="2"]Please check you specified correct db name first of all, then all your connectionString is set correctly.[/size][/color]

I had the exact same problem.

It turned out to be a typo mistake: "port:3306" instead of "port=3306".