Generate dynamic database and its table structure by Yii

we need to make new database and generate tables in it by controller every time new user is generated and than make connection with new database to fetch its data.How can we achieve it in YII 2.0

So there will be multi-connection concept in controller and in models.

You can use database command (if you have grants) to manage databases, tables, etc…etc…