How to Clone Database in MariaDB Prompt Character

copymariadb

mysqlword="wwww"
old="xxxx"
new="yyyy"
mysqldump $old  -u root -p$mysqlword   | mysql $new  -u root -p$mysqlword 

Now new database was cloned as like old database.
Can i use some command to clone database when entering mariadb terminal?

mysql -u root -pwwww
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 5.5.56-MariaDB MariaDB Server
MariaDB [(none)]> 

How can clone database in mariadb prompt character instead of inputing mysqldump $old -u root -p$mysqlword | mysql $new -u root -p$mysqlword in bash terminal?

Best Answer

General answer - No!

First of all - mysqldump it is not a simple sql command, this is complicated logic behind it, such as: - show definition of all objects - tables, routings, foreign keys - manage export import in proper order, like disable constraints and etc

Second (in addition to first) - mysql console (and SQL as language) do not support database level commands, like select all - You would need do this for each tables, objects, routines.

Federated engine (FederatedX) also not resolve "problem"