Quickly Rename MySQL Database

You can rename a MySQL database from the shell prompt using mysqldump command without storing the sql dump into a file:

mysql -u root -p'password' -e "create database newdb"
mysqldump -u root -p'password' originaldb | mysql -u root -p'password' newdb
mysql -u root -p'password' -e "drop database originaldb"

More Related Posts