LMSouq
database Open

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

DE
deadprogrammer
1 month ago
3 views
Problem Description
How do I quickly rename a MySQL database (change its schema name)? Usually I just dump a database and re-import it with a new name. This is not an option for very big databases. Apparently `RENAME {DATABASE | SCHEMA} db_name TO new_db_name;` [does bad things, exists only in a handful of versions, and is a bad idea overall][1]. This needs to work with [InnoDB][2], which stores things very differently than [MyISAM][3]. [1]: http://web.archive.org/web/20160504181056/https://dev.mysql.com/doc/refman/5.1/en/rename-database.html [2]: http://en.wikipedia.org/wiki/InnoDB [3]: http://en.wikipedia.org/wiki/MyISAM

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base