To quickly rename a mysql database you need to create the new empty database, then rename each table in turn into the new database:
RENAME TABLE old_db.table TO new_db.table;
After executing the above command then you will need to adjust the permissions after that.:
mysql -u username -ppassword old_db -sNe
'show tables' | while read table; \
do mysql -u username -ppassword -sNe "rename table old_db.$table to new_db.$table"; done
Intellipaat provides the Best Database Courses for its learners. Enroll now!