26

Is there a MySQL statement for renaming a schema? I know about RENAME {DATABASE | SCHEMA} db_name TO new_db_name;, but that statement "was found to be dangerous and was removed in MySQL 5.1.23" (as they mention in here).

I was also trying to do it using MySQL Workbench. I tried right clicking on the schema, and then alter schema. But they don't let you change its name in there.

So how do people rename databases?

Dharman
  • 30,962
  • 25
  • 85
  • 135
snakile
  • 52,936
  • 62
  • 169
  • 241
  • There are already some answers here at SO that might help with your issue: [how-does-one-rename-a-schema-in-mysql](http://stackoverflow.com/questions/490515/how-does-one-rename-a-schema-in-mysql) [cloning-a-mysql-database-on-the-same-mysql-instance](http://stackoverflow.com/questions/675289/cloning-a-mysql-database-on-the-same-mysql-instance) [how-do-i-quickly-rename-a-mysql-database-change-schema-name](http://stackoverflow.com/questions/67093/how-do-i-quickly-rename-a-mysql-database-change-schema-name) – acm Dec 28 '10 at 12:21

1 Answers1

21

If you're on the Model Overview page you get a tab with the schema. If you rightclick on that tab you get an option to "edit schema". From there you can rename the schema by adding a new name, then click outside the field. This goes for MySQL Workbench 5.2.30 CE

Edit: On the model overview it's under Physical Schemata

Screenshot:

enter image description here

chelder
  • 3,819
  • 6
  • 56
  • 90
Sondre
  • 1,878
  • 18
  • 33
  • I'm not on the Model Overview page. Isn't there a MySQL statement to rename a schema? – snakile Dec 28 '10 at 11:57
  • Ok I misunderstood then;) Thought you were modeling the DB. See you've updated the question with more details now so a fool like me can't misunderstand it;) – Sondre Dec 28 '10 at 12:35
  • Using MySQL Workbench 5.2.44 this doesn't work for me. I can change the schemata name in the edit field, but it doesn't have any effect on the actual physical schema I reverse-engineered the model from. – E-Riz Feb 09 '16 at 14:06