For security reasons the ability to rename a database was removed from later versions of MySQL. You can achieve the same goal using the methods below...
Follow the steps to duplicate the database, then drop the old database when you are done.
NOTE: Be sure to stop users/processes logging on to the database whilst performing these steps.Create a new database, then rename all the tables in the old database to be in the new database...
RENAME TABLE myolddb.mytable TO mynewdb.mytable;
Remember to DROP the old database when you are done.
You can script this process to avoid the need to manually rename a lot of tables...
mysql -u myuser myolddb -sNe 'show tables' | while read table
do
mysql -u myuser -sNe "RENAME TABLE myolddb.$table TO mynewdb.$table"
done
s - silent modeN - suppress column namese - execute the statement that follows then quit