Rename a database in MySQL

Posted by ads' corner on Monday, 2010-04-26
Posted in [Other-Dbs][Stupid]

Ever tried to rename a database in MySQL? Obviously not.

Why not? MySQL does not support renaming databases. Funny, eh?

They once tried to implement this feature but failed and removed the code again. Note the sudden major feature shifts in minor releases.

So, how to rename a database? Dump the database, create a new database and import the dump. Both steps can be executed together:

1
mysqldump old_database | mysql new_database

Categories: [Other-Dbs] [Stupid]
Tags: [Mysql] [Stupid]