Error trying to connect to the database

I have database named mydata:

I get the following error after clicking on Model Generator

---- CDbConnection failed to open the DB connection: SQLSTATE[42000] [1049] Unknown database ’ mydata’ —

Can somebody help

This is how i configured my main.php

	// uncomment the following to use a MySQL database



		'connectionString' => 'mysql:host=localhost;dbname= mydata',

		'emulatePrepare' => true,

		'username' => 'username',

		'password' => 'password',

		'charset' => 'utf8',

		'tablePrefix' => 'tbl_',


you have a space in your connection string…

Ooh thanks man, it works. Thanks very much.

SQLSTATE[HY000] [1049] Unknown database ‘yii2advanced’

i have got this error please give me solitions