Automate copying of a database

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




Return to the Artful MySQL Tips page