Normally we have to copy one database to another on the same server we download the SQL file of one db and import into another.
This approach works fine for small databases. If you have huge database like more than 2 GB, then this process takes really long time and sometimes crashes the PHP Myadmin.
Here is a piped command through which we can copy one databse into other.
db1: is the databse from where we want to copy
db2: is the databse where we will copy.
mysqldump -u <user name> --password=<pwd> db1 | mysql -u <user name> -p db2
It will ask for the password and your db1 will be copied to other db2.
** Note: source and destination databses should arleady exist before running this command.