How to duplicate a database in mysql/mariadb
When backup database, don’t use option –databases. It will create use database command.
mysqldump -u root -p oldDB > oldDB.sql
mysql -u root -p --execute="create database newDB;"
mysql -u root -p newDB < oldDB.sql
Written on November 9, 2016