According to my readings and tests, MySQL doesn’t support database renaming. Well, at least I didn’t have success with the following:
rename database old_dbname TO new_dbname;
A quick solution is to export the existing database, create a new one with the desired name, and re-import the former into the latter:
mysqldump -u username -p -v old_dbname > old_dbname.sql mysqladmin -u username -p create new_dbname mysql -u username -p new_dbname < old_dbname.sql
If you’re not planning to use the old database, don’t forget to drop it.