How To Change Database Name In MySQL
You can’t directly rename a database in MySQL. You basically need to create a new DB, copy the data over, and then remove the old databse.
Create the new database:
CREATE DATABASE my_new_database2;
Backup the old database:
mysqldump -u username -p my_old_database1
Restore to the new database:
mysql -u username -p my_new_database2 < backup.sql
Delete the old database:
DROP DATABASE my_old_database1;