What's the best way to change a MySQL database name?

Hit this exact issue last year with a 50GB production database. Best approach I found was mysqldump with --single-transaction plus sed to swap database names on the fly. Run mysqldump --single-transaction --routines --triggers old_db | sed ‘s/old_db/new_db/g’ | mysql new_db - works great for InnoDB since single-transaction keeps everything consistent. Skips the table-by-table mess that breaks foreign keys and stored procedures. Slower than CREATE TABLE AS SELECT but way safer when you can’t afford data corruption.