更改列排序规则
我已经建立了一个数据库。我正在尝试将用户名列上的排序规则更改为区分大小写,以便将登录参数限制为他们注册的内容。
但是我不断收到此消息: #1025 - Error on rename of './yebutno_ybn/#sql-76dc_8581dc' to './yebutno_ybn/user' (errno: 150)
由于存在外键约束相关表格...
有什么想法吗?这将为我省去很多 php 方面的麻烦!
谢谢, 斯特凡
I have a database already set up. I am trying to change the collation to case sensitive on my username column so it restricts login parameters to what they signed up with.
However I keep getting this: #1025 - Error on rename of './yebutno_ybn/#sql-76dc_8581dc' to './yebutno_ybn/user' (errno: 150)
there is foreign key constraints due to related tables....
any ideas? this will save me a lot of hassle with the php side of things!
Thanks,
Stefan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除了禁用 FOREIGN_KEY_CHECKS 之外,您还可以删除外键,然后重新创建它。如果重建索引可能需要很长时间,这可能不是一个好主意。
请注意,更改排序规则可能会孤立某些行。 STEfan 将不再与 stefan 相关……因此您可能需要对此进行调查,看看是否会发生任何事件,并在继续之前决定您将采取什么措施。
In addition to disabling FOREIGN_KEY_CHECKS, you could just drop the foreign key, do you stuff, recreate it. Probably not a good idea if rebuilding the index might take a real long time.
Be aware, changing collation might orphan some rows. STEfan will no longer be related to stefan...so you might want to investigate this to see if you will have any occurrences, and decide what you will do about it, before you proceed.
我认为您可以使用以下方法关闭外键约束:
完成调整后,您可以重新启用它们。不过,我建议复制数据库并首先在副本上尝试此操作。
I think you can turn off foreign key constraints by using something like:
After your done adjusting, then you can enable them back. However i would recommend making a copy of the db and trying this on the copy first.