I had the same problem.
So one solution is with Runtime.getRuntime().exec()
String command = "mysqldump -u <your login> --password=<your password> <database name to clone> | mysql -u root --password=<your password> <new database name>";
Process p = Runtime.getRuntime().exec(new String[]{"bash","-c",command});
Disadvantages: You need to store your password somewhere safely. It's not system independent.
Other solution (I think better one) is to run SQL file which will create your database schema. In mysql you can easily use mysqldump to generate schema for you.
Resource resource = new ClassPathResource(defaultDatabaseSchemaFilePath);
ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator(resource);
DataSource dataSource = multiTenantDataSource.getDataSource(dbName);
databasePopulator.execute(dataSource);
Disadvantages: In your SQL file in the beginning you need to add SET FOREIGN_KEY_CHECKS=0; and in the end SET FOREIGN_KEY_CHECKS=1; as databasePopulator executes commands one by one and probably there will be foreign key check problem.
Hope it will help someone in the future.
mysqldumpto do this?