MySQL: Clone a existing Database on the command line


Today i had to create a clone of a production database to run some tests to another than the production database, so here are two ways to do this very fast and as a one liner on the command line:


mysql -u -p -e "create database " && mysqldump -u -p  | mysql -u -p 


mysqladmin create  -u -p && mysqldump -u -p  | mysql -u -p