Dynamic Schema Creation and Switching
First one is how to create database dynamically.

set @db_name:= 'db_name';
set @statment = CONCAT('CREATE DATABASE ', @db_name);
prepare stmt_create FROM @statment;
execute stmt_create;
deallocate PREPARE stmt_create;


Now you want to dump some table into it.

set @db_name="db_name";
set @start_syntax="CREATE TABLE ";
set @table_syntax=".`table_name` (id int(4)) ENGINE = InnoDB;";
set @stat_execute=concat(@start_syntax,@db_name,@table_syntax);
prepare stat_ment from @stat_execute;
execute stat_ment;
deallocate prepare stat_ment;


In this way you can create database and dump the table.