Rename a database in MySQL
1 : take backup of the database to be renamed
mysqldump -u root -p -R school_dev > school_dev.sql
2 : in the backup file Replace <UserName> and <Password> with the actual credentials for the database, and replace <DB_Name> with the exact name of the database you’re changing. There should be no space between -p and the password.
The -R flag indicates that the dump file should retain all stored procedures and functions.
3. Create a new blank database by using the mysqladmin command:
mysqladmin -u root -p create school_dev_rp
Enter password: *********
4 . Import the dump file into the new database you created:
mysql -u root -p school_dev_rp < school_dev_rp.sql
Enter password: *********
5 : Delete the old MySQL database name (optional):
mysqladmin -u root -p drop school_dev
Enter password: *********
Dropping the database is potentially a very bad thing to do.
Any data stored in the database will be destroyed.
Do you really want to drop the 'school_dev' database [y/N] y
Database "school_dev" dropped