Renaming a MySQL Database

MySQL
Option-1 To reduce IO use the following.

mysqladmin -u username -p create newdatabase
mysqldump -u username -v olddatabase -p | mysql -u username -p -D newdatabase

Option-2 Renaming a MySQL Database:

In Linux shell, use mysqldump to back up the old database, then restore the dumped database under a new name using the MySQL utility.
Finally, use the drop database command to drop the old database. This option can perform badly for large database.

mysqldump -u root -p newdb > newdb.sql
mysql -uroot -p -e “CREATE DATABASE newdb1”
mysql -uroot -p newdb1 < newdb.sql
mysql -uroot -p -e “DROP DATABASE newdb”

Option-3 Use these few simple commands

mysqldump -u username -p -v olddatabase > olddbdump.sql
mysqladmin -u username -p create newdatabase
mysql -u username -p newdatabase < olddbdump.sql