The MySQL manual at MySQL covers this.
Usually I just dump the database and reimport it with a new name. This is not an option for very big databases. Apparently
Emulating the missing RENAME DATABASE command in MySQL:
Create the rename queries with:
SELECT CONCAT('RENAME TABLE ',table_schema,'.',table_name,
' TO ','new_schema.',table_name,';')
FROM information_schema.TABLES
WHERE table_schema LIKE 'old_schema';
Run that output
It was taken from Emulating The Missing RENAME DATABASE Command in MySQL.