无法使用 MYSQL Workbench 更改 MYSQL 5.5 中的架构名称
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13693665/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot alter schema name in MYSQL 5.5 w/ MYSQL Workbench
提问by GrayFullBuster
Why I cannot alter my schema name from the MYSQL Workbench? Am i missing something? :(
为什么我无法从 MYSQL Workbench 更改我的架构名称?我错过了什么吗?:(
As you can the name is dissabled
尽你所能,名称已禁用
回答by Gavin Towey
There is no RENAME available for schema names. You will have to export the schema, then import with a new database name.
模式名称没有可用的 RENAME。您必须导出架构,然后使用新的数据库名称导入。
This is a limitation of the MySQL server itself.
这是 MySQL 服务器本身的限制。
回答by Hasitha Priyasad Wijerathna
Actually, you can rename database name very easily,
实际上,您可以非常轻松地重命名数据库名称,
- go to the top menu -> Database -> reverse engineering, select your database and keep go further until you get the er diagram of your database,
- after the there is an area called Catalog Area under that you can see your database name, right click on that and select edit schema. and change your database name
- now again go to the top menu -> database -> forward engineering and completed the database engineering using the wizard.
- 转到顶部菜单 -> 数据库 -> 逆向工程,选择您的数据库并继续前进,直到您获得数据库的 er 图,
- 在有一个名为 Catalog Area 的区域之后,您可以在该区域下看到您的数据库名称,右键单击该区域并选择编辑模式。并更改您的数据库名称
- 现在再次转到顶部菜单-> 数据库-> 正向工程并使用向导完成数据库工程。
回答by EternalHour
I can't imagine that anyone is still using version 5.5, but here is the procedure I followed in version 8. If you do have an older/newer version this may still work.
我无法想象有人仍在使用 5.5 版,但这是我在 8 版中遵循的过程。如果您有较旧/较新的版本,这可能仍然有效。
- Connect to the database.
- Open the Database menu and choose Migration Wizard.
- Start Migration.
- Both source and target will be the current MySQL server.
- Select the schema you want to rename.
- For Source Objects make sure all the tables are selected.
- Click Next and you will see a message that the source and target are the same.
- Now you should see a "Manual Editing" step.
- Under the Target Object column, click on the database name and change it.
- Now you can click next all the way through.
- Once finished you will have a newly renamed schema.
- 连接到数据库。
- 打开数据库菜单并选择迁移向导。
- 开始迁移。
- 源和目标都将是当前的 MySQL 服务器。
- 选择要重命名的架构。
- 对于源对象,确保选择了所有表。
- 单击下一步,您将看到一条消息,指出源和目标是相同的。
- 现在您应该看到“手动编辑”步骤。
- 在目标对象列下,单击数据库名称并进行更改。
- 现在您可以一直单击下一步。
- 完成后,您将拥有一个新重命名的架构。
Currently my database has no indexes, stored procedures, etc. You will want to confirm all related objects are migrated as well before dropping the old database.
目前我的数据库没有索引、存储过程等。在删除旧数据库之前,您需要确认所有相关对象都已迁移。
回答by Limbic
Gavin is right, but if your server have phpMyAdmin, you can use it to rename your database (schema):
Gavin 是对的,但如果您的服务器有 phpMyAdmin,您可以使用它来重命名您的数据库(架构):
Go to your phpMyAdmin URL. Default is http://yourdomain.com/phpMyAdmin/
If prompted, enter your database username and password.
Click on "Operations" tab.
Under "Rename database to:" write your new database name.
Click "Go" button.
If prompted, click "OK".
After some seconds, depending on your database content, you will have your database renamed.
转到您的 phpMyAdmin URL。默认为http://yourdomain.com/phpMyAdmin/
如果出现提示,请输入您的数据库用户名和密码。
单击“操作”选项卡。
在“将数据库重命名为:”下写下您的新数据库名称。
单击“开始”按钮。
如果出现提示,请单击“确定”。
几秒钟后,根据您的数据库内容,您将重命名数据库。
What phpMyAdmin is actually doing is create a new database with your new name, import the content from your current database and delete your current database.
phpMyAdmin 实际做的是用您的新名称创建一个新数据库,从当前数据库中导入内容并删除当前数据库。