Another common question I receive about MySQL Shell Dump & Load Utility is how to dump a schema and load it with another name. Make a copy in fact.
Dumping the Schema
To do so, we need to use the dumpTables() method:
JS util.dumpTables("test", [], "/tmp/dump", {all: true})
It is important to notice that the second parameter is an empty array and the option “all” is enabled.
This will dump all tables of the test schena into /tmp/dump.
Loading the data into another Schema
Now, we will load the data we previously dump into another schema.
The first thing to do is to create the destination schema:
JS \sql create database test2
And finally, we load the data:
JS util.loadDump("/tmp/dump", {schema: "test2"})
Of course, you can always increase the parallelism using the threads option.
You can also load into another server.

How would you copy stored procedures, triggers, views… to the new schema?
it looks like all our tools are not a complete solution for this old problem…
mysqldump: it cannot strip definers but it can omit the source schema name
mysqlpump: it can strip definers but it cannot omit the source schema name
mysql-shell – dumpTables: well just tables
mysql-shell – dumpSchema: it cannot omit the source schema name