tags:

views:

806

answers:

2

Hi I am using mysql 5.0.x

How do I rename a schema?

+2  A: 

Under 5.0, you need to dump the database and reload it into a new database with a new name. If you upgrade to 5.1, you can lookup and use the RENAME DATABASE command.

Grant Limberg
+3  A: 

Don't use RENAME DATABASE!!!

Early 5.1 versions had this command but it's been removed since it can corrupt data (reference).

The only way at present is

mysqladmin create new_db_name
mysqldump db_name | mysql new_db_name

as referred to here

Edit: Obviously this answer will become dated once this gets fixed.

pufferfish