The MySQL manual at MySQL covers this.
Usually I just dump the database and reimport it with a new name. This is not an option for very big databases. Apparently
This is what I use:
$ mysqldump -u root -p olddb >~/olddb.sql $ mysql -u root -p mysql> create database newdb; mysql> use newdb mysql> source ~/olddb.sql mysql> drop database olddb;