如何重命名MySQL中的索引?(How do I rename an Index in MySQL)

编程入门 行业动态 更新时间:2024-10-24 10:22:52
如何重命名MySQL中的索引?(How do I rename an Index in MySQL)

我想重命名索引。 我查看了alter table文档,但是我无法弄清楚简单地重命名索引的语法。 当通过MySQL GUI进行操作时,它会丢弃索引,并创建一个新的索引。 虽然这样做,我想避免重建整个索引,只是为了更改索引的名称。

[附加信息]

在alter table文档中说明

只能修改表元数据而不是表数据的更改可以通过更改表的.frm文件而不是触摸表内容立即进行。 以下更改是可以通过以下方式进行的快速更改:

* Renaming a column or index.

但是,当我尝试通过编辑.frm文件(在测试数据库上)并重新启动服务器来重命名索引时,它现在在尝试列出列时声明“无法获取列”,并且在尝试运行时一个查询,它返回错误“Unknown table engine”“”。 .frm文件有很多二进制内容。 是否有一个很好的工具来编辑二进制信息。

I would like to rename an index. I've looked at the alter table documentation, but I can't figure out the syntax to simply rename an index. When doing it through the MySQL GUI, it drops the index, and creates a new one. While this works, I would like to avoid rebuilding the entire index just to change the name of an index.

[ADDITIONAL INFO]

In the alter table documentation it states

Alterations that modify only table metadata and not table data can be made immediately by altering the table's .frm file and not touching table contents. The following changes are fast alterations that can be made this way:

* Renaming a column or index.

However, when I tried to rename the index by editing the .frm file (on a test database) and restarting the server, it now states "Could not fetch columns" in the UI when trying to list the columns, and when trying to run a query, it returns the error "Unknown table engine ''". The .frm file has a lot of binary content. Is there a good tool for editing the binary info.

更多推荐

本文发布于:2023-08-03 15:11:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1393602.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重命名   索引   Index   MySQL   rename

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!