Rename MySQL Database

No sql command to do it!

Rename command will include in MySQL 5.1.7 or above!
It is easy feature, Why waiting till 5.1.7?

Don't worry. I have 2 solutions.

1. Rename database folder.

Haha it easy! Just shutdown MySQL then renames it. This way need shutdown, it not good for production server. So what’s next solution?

2. Dump data
Dump whole database to new one. Use below command

$ mysqladmin create new_db
$ mysqldump --opt old_db | mysql new_db
*
Make sure no one use database while moving.

So basic but why MySQL miss it!!??

Comments

Popular Posts