How do I quickly rename a MySQL database (change schema name)?
Asked 07 September, 2021
Viewed 1.7K times
  • 60
Votes

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 RENAME {DATABASE | SCHEMA} db_name TO new_db_name; does bad things, exist only in a handful of versions, and is a bad idea overall.

This needs to work with InnoDB, which stores things very differently than MyISAM.

30 Answer