RENAME DATABASE
RENAME {DATABASE|SCHEMA} database TO database[,...]Use this statement to rename a given database to a new name,
given after the TO keyword. While a database is being renamed, no other client can
interact with the database involved. Tables that are currently locked
or tables that are part of a transaction in progress cannot be
renamed. Additional databases may be renamed in the same statement,
given in a comma-separated list. This statement was added in version
5.1.7 of MySQL. As of version 5.0.2 of MySQL, the keyword
DATABASE is synonymous with
SCHEMA:
RENAME DATABASE personnel TO human_resources, applicants TO human_resources_applicants;
In this example, the name of the database called
personnel is changed to human_resources, and
applicants is changed to
human_resources_applicants, to coincide with a
renaming of the department to which they relate. All of the tables and
data are the same and continue to exist in the directories with the
new database names.