Automate database copy

from the Artful MySQL Tips List


Substitute your MySQL username, MySQL password and the database name in ...
mysqldump -uUSR -pPWD DBNAME --no-create-db -K -E -R >DBNAMEtmp.sql 
mysqladmin -uUSR -pPWD create schema DBNAMEbak 
echo use DBNAMEbak > DBNAME.sql 
type DBNAMEtmp.sql >> DBNAME.sql

Last updated 23 Aug 2024


Return to the Artful MySQL Tips page