Learn How to How to Clone a Magento 2 database via ssh
If you want to copy all data from database1
 to database2
 via SSH – duplicate database1
.
using this command
mysqldump -u Databse-username -p Databasename > newdatabasename.sql
Command promote for password Enter your database password and press enter it will take some time based on your database size,
You are done go in mysql and test your magento 2 database has been closed