How do I quickly rename a MySQL database (change schema name)?

前端 未结 30 2786
余生分开走
余生分开走 2020-11-22 14:54

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

30条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 15:04

    I've only recently came across a very nice way to do it, works with MyISAM and InnoDB and is very fast:

    RENAME TABLE old_db.table TO new_db.table;
    

    I don't remember where I read it but credit goes to someone else not me.

提交回复
热议问题